anixon Posted March 20, 2010 Posted March 20, 2010 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..
KaFu Posted March 20, 2010 Posted March 20, 2010 Try this: FileCreateShortcut(@SystemDir & "\schtasks.exe", @DesktopDir & "\Test.lnk", @WindowsDir, '/run /tn "Test"', "This is a link to Test", @ScriptDir & "\Icons\Test.ico", "", "", @SW_MINIMIZE) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
anixon Posted March 20, 2010 Author Posted March 20, 2010 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..
KaFu Posted March 20, 2010 Posted March 20, 2010 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 ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now