Open mocallins opened 1 year ago
You can install sudo from choco (https://community.chocolatey.org/packages/gsudo)
sudo notepad
starts notepad elevated. I just tested it
Ok, i will try that. Thanks
On Tuesday, August 1, 2023 at 08:30:31 AM CDT, Oleg Shilo ***@***.***> wrote:
You can install sudo from choco (https://community.chocolatey.org/packages/gsudo) sudo notepad
starts notepad elevated. I just tested it
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Got gsudo installed. Works from the command line, but not from the script i defined in Shell-X
I tested it. Seems to work as expected:
Yea the bat files don't seem to be getting executed from the context menu.when i double click on the actual bat file, it runs. Strange Is it a Windows version issue ? just spit balling, trying to help you, help me, lol I'm on Windows 8.1 Pro
On Tuesday, August 1, 2023 at 10:03:31 PM CDT, Oleg Shilo @.***> wrote:
I tested it. Seems to work as expected:
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I would not expect it to be different (win10 vs win8). But who knows :(
It might be about the way sudo
behave in your environment.
What you can try is just to have a simple hello-world style app that always executes the arguments it receives as an elevated process. Basically the replacement for sudo.
static void Main(string[] args)
{
var startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.FileName = args[0];
startInfo.Arguments = "\"" +string.Join( "\" \"", args.Skip(1).ToArray()) + "\"";
startInfo.Verb = "runas";
Process.Start(startInfo);
}
gsudo is working.
The script i have defined, does not seem to be getting executed from the shell-x context menu. The script works from the command line and double click in the desktop, just not via the context menu
gsudo is working. The script i have defined, does not seem to be getting executed from the shell-x context menu.
These two statements contradict each other. When you use gsudo you are asking it to start and then execute what you have passed to it so when you execute gsudo + args
from cmd prompt it behaves as expected but when from the context menu then it fails to start the args
. So it does not work in your environment as it does in Win10.
Thus I suggested you write your own gsudo where you have full control. IE you can wait until new process exists. You can even debug it.
Maybe we have a language disconnect.When i execute the bat file defined in Shell-x, manually at the command prompt, it works.But when i select the option in the Shell-x context menu, it does not work.I don't even see it responding, as i do, at the command prompt. Again, gsudo is working, "at the command prompt, manually".I believe the script defined in Shell-x menu, is not getting launched. Its not that gsudo isn't working, i don't think its even being run. The bat files, and i have 2 for this usage, are not getting run, "from" the context menu.When i test "manually, at the command prompt", they work.
On Thursday, August 3, 2023 at 06:04:29 PM CDT, Oleg Shilo ***@***.***> wrote:
gsudo is working. The script i have defined, does not seem to be getting executed from the shell-x context menu.
These two statements contradict each other. When you use gsudo you are asking it to start and then execute what you have passed to it so when you execute gsudo + args from cmd prompt it behaves as expected but when from the context menu then it fails to start the args. So it does not work in your environment as it does in Win10.
Thus I suggested you write your own gsudo where you have full control. IE you can wait until new process exists. You can even debug it.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Sorry, it looks like we are stuck in the loop.
Forget about the command prompt for a moment.
This is what I know from your problem description:
notepad.exe
)You cannot execute (from the shell context menu) a batch file containing complex command that starts with sudo
(e.g. sudo notepad.exe
)
Is it correct?
If it is then you have a problem with gsudo.exe (sudo
is nothing else but a shim to gsudo.exe). For example, gsudo can exit immediately after starting and make an impression that it fails.
You also know from me that the problem is specific to your environment. I shared with you the desktop recording demonstrating that the solution works on Win10 just fine.
I also described for you the possible solution - implementing your own gsudo.exe equivalent.
All this puts you in a reasonable position to tackle the problem.
I verified that the builtin setup for .txt works from the context menu2. I modified the same .txt, to perform "gsudo notepad", and it worked as well. gsudo is working as expected.
On Friday, August 4, 2023 at 08:31:56 AM CDT, Oleg Shilo @.***> wrote:
Sorry, it looks like we are stuck in the loop.
Forget about the command prompt for a moment.
This is what I know from your problem description:
Is it correct?
If it is then you have a problem with gsudo.exe (sudo is nothing else but a shim to gsudo.exe). For example, gsudo can exit immediately after starting and make an impression that it fails.
You also know from me that the problem is specific to your environment. I shared with you the desktop recording demonstrating that the solution works on Win10 just fine.
I also described for you the possible solution - implementing your own gsudo.exe equivalent.
All this puts you in a reasonable position to tackle the problem.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Great. Then your problem seems to be solved.
===============
As a suggestion, please consider not using an email client for posting messages to GitHub but messaging directly from the GitHub issues page instead. As you can see on this page all your messages have unnessesary "previous message" and also loose formatting.
I've found a few examples of how to modify a batch file to elevate, but none of them seem to work. Any suggestions ?