Closed RamonUnch closed 1 year ago
Nice, thanks!
Note the following command will create a task to start altsnap as administrator when you login
schtasks /create /f /tn "RunAltSnap" /tr "%appdata%\AltSnap\AltSnap.exe" /sc onlogon /rl highest
The problem with the above is that AltSanp will be killed after 3 days. The only way to disable this killing is to use an .xml file.
Also if you probably want to add a small delay, this is done with the /DELAY 0:10
option.
@RamonUnch, why is a delay useful? Is it just because you don't need to slowdown the login and also not (likely) need to move a window in the first 10-30 seconds?
Also, I think "/st 99999:00" would basically allow it to run forever, effectively.
I added the delay because some users experienced problems when AltSnap starts before after the explorer, so I keep it as a safety measure. /st
is for start time so it is supposed to be in the 24 hour format? I am misreading the doc?
I think you are correct and all the options that look like they might work are not compatible with MINUTE, HOURLY, ONSTART, ONLOGON, ONIDLE, ONEVENT.
So you'd have to open the GUI and uncheck the box anyway.
If you can do it with schtasks
it does not look simple. I'm with you now @RamonUnch, it's a bit of a fail on schtasks
.
Yes, I confirm the command line that I used will shut down altsnap after 3 days
I tried /st 99999:00
but it does refuse to work
Another potential problem is this task runs for every user, but the path of the executable refers to a specific user, it seems that %APPDATA% gets dereferenced on the command line.
One problem I notice with the AltSnap.xml is that it must be modified before use as it has a placeholder path
In the command line schtasks.exe /CREATE /XML .\AltSnap.xml /TR "%~dp0AltSnap.exe" does that override the action's command ?
Answer, no you cannot use /TR with /XML
As Is, this creates a task with the wrong executable
So I tried a relative path
promising
Well, I have to reboot to give this a test so this post ends here
Ok, I have tested this and it works
Please modify the
from
<Command>C:\your\full\path\toAltSnap\AltSnap.exe</Command>
to
<Command>%appdata%\AltSnap\AltSnap.exe</Command>
As per the attached copy of AltSnap.xml
To create the task, (in an administrator command prompt)
schtasks /create /f /XML "%appdata%\AltSnap\AltSnap.xml" /tn "RunAltSnap"
To delete the task
schtasks /f /delete /tn "RunAltSnap"
Well, basically the option is
schtasks.exe /CREATE /XML .\AltSnap.xml /TR "%~dp0AltSnap.exe"
The task can be created without the xml file but it will get terminated after 3 days and there are no ways to change that unless yu use an xml file.