Closed Lostion1 closed 3 months ago
This is what's happening:
When you run gsudo.exe -s echo Test>test.txt
then gsudo -s echo Test
is executed, which elevates echo Test
as System.
Then the parent CMD.EXE
which is not elevated sends the results of the command to > test.txt
. That operation fails.
The solution is to ensure the redirection to a file is done within the elevated context, for example with: gsudo "echo Hi! > hello.txt"
which will elevate the whole thing, including the redirection.
Makes sense? Feel free to ask if you have any doubts. Thank you for using gsudo.
Issue Description
If i create a folder in C:\Program Files (x86) called Test (C:\Program Files (x86)\Test) then i put gsudo.exe in and make a .bat with the following:
gsudo.exe echo Test>test.txt
i get "Access denied"
Same with: gsudo.exe -s echo Test>test.txt gsudo.exe -ti echo Test>test.txt
It only works if i start an gsudo.exe shell before which defeats my purpose (i only need gsudo for certain commands).
Steps to Reproduce
Context:
gsudo v2.5.1 (Branch.tags-v2.5.1.Sha.25d89fcac99b25534108804cb843fcbebe05a872)