Jump to content

Recommended Posts

Posted

I am trying to produce a short cut Desktop Icon with the 'Target' detail exactly as follows:

C:\Windows\System32\schtasks.exe /run /tn "test"

Using this code:

FileCreateShortcut(@SystemDir & "\schtasks.exe /run /tn " & '"test"', @DesktopDir & "\Test.lnk", @WindowsDir, "", "This is a link to Test", @ScriptDir & "\Icons\Test.ico", "", "", @SW_MINIMIZE)

A Desktop Icon is created but without the Target being entered. Please note that the syntax required by schtasks.exe [Microsoft Task Scheduler] for run and tn is a forward slash /run and /tn and test has to enclosed in double quotes as follows "test"

Help is always appreciated Ant.. Posted Image

Posted

Your example works perfectly thank you very much I never would have got to that solution. On the subject of schtasks.exe have you had any experience with an AutoIT Script that can at the command line 'CMD' create a Scheduled Task where the following CMD line input creates the task schtasks.exe /Create '/Tn "Test" ..... Ant..

Posted

I never would have got to that solution.

Just read the help-file very carefully, often single words make the difference :)... I've learned this the hard way too :(...

FileCreateShortcut(@SystemDir & "\schtasks.exe", @DesktopDir & "\Test.lnk", @WindowsDir, "/Create '/Tn ""Test""", "This is a link to Test", @ScriptDir & "\Icons\Test.ico", "", "", @SW_MINIMIZE)

Remember that quotes are used to escape quotes :)...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...