Closed VladKappa closed 2 months ago
Thanks for your effort.
I do not know in which context but I am sure /TR
was working fine on my PC with an xml file. I guess it was Win7/XP...
So you actually need to edit the xml file before starting the batch? I guess you should prompt the user to do that instead of saying it in an invisible comment.
Especially considering the script probably runs from same dir as altsnap.exe, it would be nice for the path to be set automatically.
That said, this commit does fix the problem for me on Win11. Does that mean this breaks the script for Win7/XP?
This was the error on win11 before the commit:
PS C:\Users\rusty\AppData\Roaming\AltSnap> .\sch_On.bat
=============================================================================
= Setup Scheduled task for elevated AltSnap auto-start without UAC prompt =
= If you do not want to continue, close the window or hit Ctrl+C =
=============================================================================
Going to run command:
schtasks.exe /CREATE /XML .\AltSnap.xml /TR "C:\Users\rusty\AppData\Roaming\AltSnap\AltSnap.exe"
Press any key to continue . . .
C:\Users\rusty\AppData\Roaming\AltSnap>schtasks.exe /CREATE /XML .\AltSnap.xml /TR "C:\Users\rusty\AppData\Roaming\AltSnap\AltSnap.exe"
Invalid syntax. Mandatory option 'tn' is missing.
Type "CREATE /?" for usage.
Press any key to continue . . .
PS C:\Users\rusty\AppData\Roaming\AltSnap>
Hope that helps. Thank you both for everything.
Your pach seems fine, I was just saying you should add the
:: Make sure to adjust the path to the AltSnap executable in the AltSnap.xml file.
line into an @echo
line..
Also maybe %APPDATA%\AltSnap\AltSnap.exe would work? if it did it would be a good default for the AltSnap.xml file...
Perhaps task scheduler behaves differently on Win 10/11?
Checked with path %APPDATA%\AltSnap\AltSnap.exe
in XML and it works.
But in case AltSnap is installed in a custom location then the user should adjust the XML.
Thank a lot for your help!
The scheduled task batch script did not work so I adjusted it & added a note to edit the path from the XML file.
It seems that /TR (task run program path) can't be used with /XML
also, /XML seems to require /TN (task name)
Fixes https://github.com/RamonUnch/AltSnap/issues/505