Page 1 of 1
open with admin permissions - doesn't work with arguments
Posted: 05 Nov 2024 23:18
by highend
v26.60.0103
Ofc doesn't create the folder but passes "hello" to the .bat file correctly:
Code: Select all
open """D:\!tests\bat\test.bat"" ""hello""", "w";
Fails to create the folder and doesn't even display a cmd window in a fresh instance:
Code: Select all
open """D:\!tests\bat\test.bat"" ""hello""", "we";
.bat content:
Code: Select all
echo 1: %1
mkdir "C:\Program Files (x86)\Test"
Re: open with admin permissions - doesn't work with arguments
Posted: 06 Nov 2024 10:15
by admin
The parameters were not stripped of the surrounding quotes, and strangely the elevated process could not handle the quoted parameters, but the normal process could. In the next beta the quotes will be removed and everything will work fine.
PS: Well, if the parameters contain spaces the quotes are needed, of course. But the elevated process also fails with quoted parameters that contain spaces.

Don't see a solution for that.

Re: open with admin permissions - doesn't work with arguments
Posted: 06 Nov 2024 11:45
by highend
I'll currently stay with nircmd in this case.
It doesn't remove any quotes (can be done inside the .bat if necessary) so arguments with spaces aren't a problem here, e.g.:
Code: Select all
e|run lax("<xydrive>\Tools\nircmd\nircmd_x64.exe" elevatecmd exec runas "D:\test.bat" "hello world");
Re: open with admin permissions - doesn't work with arguments
Posted: 06 Nov 2024 12:08
by admin
Re: open with admin permissions - doesn't work with arguments
Posted: 06 Nov 2024 13:48
by highend
Confirmed fixed with v26.60.0105
One thing (not related to this bug report!) why I still like nircmd more...
It automatically sets the working folder so that a .bat like this just works without any issues...
Code: Select all
ffmpeg.exe -y -i audio.aac -i video.mp4 -acodec copy -vcodec copy muxed.mp4
Re: open with admin permissions - doesn't work with arguments
Posted: 06 Nov 2024 15:16
by admin
Confirmed. I don't have a fix for this at the moment. The directory is passed as it should be according to the docs. <shrug>