open with admin permissions - doesn't work with arguments

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
highend
Posts: 14991
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

open with admin permissions - doesn't work with arguments

Post 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"
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66543
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: open with admin permissions - doesn't work with arguments

Post 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. :om: Don't see a solution for that. :|

highend
Posts: 14991
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: open with admin permissions - doesn't work with arguments

Post 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");
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66543
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: open with admin permissions - doesn't work with arguments

Post by admin »

Ha, I could fix it. :beer: This page helped: https://stackoverflow.com/questions/312 ... es-in-path

Next beta...

highend
Posts: 14991
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: open with admin permissions - doesn't work with arguments

Post 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
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66543
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: open with admin permissions - doesn't work with arguments

Post 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>

Post Reply