Sign in to follow this  
Followers 0
ken82m

SCHTASKS.EXE - Can't pass parms to App

3 posts in this topic

#1 ·  Posted (edited)

I won't put you to sleep you with the code but here is the end result of it all:

schtasks /CREATE /TN "MyMovies Backup Job" /RU SYSTEM /SC Hourly /ST 01:01:00 /MO 01 -TR "C:\MyMovies Back\MyMovies MAIN SCRIPT.exe -backup"

If I run that from a command line the job is created. But if you go into properties the program to run is:

C:\MyMovies Back\MyMovies MAIN SCRIPT.exe -backup

What I need it to be is:

"C:\MyMovies Back\MyMovies MAIN SCRIPT.exe" -backup

I've tried different variations of quotes, no quotes, parms after quotes etc but can't get it to work.

Anyone have any ideas?

Thanks,

Kenny

Edited by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try

schtasks /CREATE /TN "MyMovies Backup Job" /RU SYSTEM /SC Hourly /ST 01:01:00 /MO 01 -TR """C:\MyMovies Back\MyMovies MAIN SCRIPT.exe"" -backup"
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

try

schtasks /CREATE /TN "MyMovies Backup Job" /RU SYSTEM /SC Hourly /ST 01:01:00 /MO 01 -TR """C:\MyMovies Back\MyMovies MAIN SCRIPT.exe"" -backup"
If the command shell is stripping off a set of quotes when schtasks runs, then you might also use the 8.3 short path to eliminate the need for them:
$sShortName = FileGetShortName("C:\MyMovies Back\MyMovies MAIN SCRIPT.exe")
$sExtCmd = 'schtasks /CREATE /TN "MyMovies Backup Job" /RU SYSTEM /SC Hourly /ST 01:01:00 /MO 01 -TR "' & $sShortName & ' -backup"'
Run($sExtCmd, @TempDir)

Note the single quotes enclosing the string that includes double quotes.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0