2

Is there a way to execute a desktop shortcut on a scheduler? I've tried the task scheduler but when I specify the shortcut, it changes it automatically to the underlying exe file.

1
  • See this link. Also.. I haven't tried it for the scheduler.. but there is an environment variable called PATHEXT. If you permanently add .LNK to the system version of the variable, the scheduler might very well launch it. I am too lazy to test it. Also.. this could potentially be a way for baddies to launch things too but it is what you asked for. If you can't, then try cmd.exe /c "start .... " with the lnk after the change. Commented Apr 28, 2020 at 20:19

2 Answers 2

2

Requested Way

To accomplish what you requested, when you add the Action to the scheduled task, you need to enter the following (here I am launching PuTTY):

cmd.exe /c "C:\Users\username\desktop\putty.lnk"

This will accomplish what you requested. (Note: the /c "C:\users\username\desktop\putty.lnk" goes into the "Add Arguments:" field.

The Better Way

What you are describing is normal behavior, and is what I would expect to happen. To give a bit of information, when you run a shortcut you are actually running the executable and possibly specifying additional parameters. To verify this right click on the shortcut in question | Select Properties and look at the "Target" field. For example this is the target for my Chrome shortcut:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

If you need to add additional parameters to the scheduled task, you can add in the Add Arguments (Optional) field. For example I have a PowerShell script set up as a scheduled task and add the -ExecutionPolicy Bypass parameter in the Add arguments field.

Scheduled Task

Here is an additional resource if you need to pass multiple arguments in the scheduled task.

2
  • This doesn't answer his question even if it is the right way to go about things. Commented Apr 28, 2020 at 20:22
  • @SeñorCMasMas You are correct, I have edited my answer to give both the requested and the better way. Commented Apr 28, 2020 at 21:12
0

Creat a shortcut with the following:
schtasks /run /tn "taskname"

Additionally you could use python to completely bypass the command prompt.

from subprocess import Popen, DEVNULL, CREATE_NO_WINDOW

Popen([
    'schtasks.exe',
    '/run',
    '/tn',
    'Cheat Engine',
], stdout = DEVNULL, stderr = DEVNULL, creationflags = CREATE_NO_WINDOW).wait()

Cheat Engine runs under the Administrator privileges and I use Task Scheduler to bypass the UAC prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .