Jump to content

Recommended Posts

Posted

I would like to create a scheduled task from a script.

This is the command (which does work):

schtasks /create /S MYCOMPUTER /RU USER1 /RP neverguessme /TN FP-Win-Scan /SC DAILY /ST 23:00:00 /TR "\"C:\Program Files\FSI\F-Prot\FP-Win.exe\" /NORMAL=C:"

I would like it to be part of a AutoIt script using the Run() function. However, I am having difficulties since the above command already has escape characters for the quotes to translate as literals.

This is what I am trying:

Run("schtasks /create /S MYCOMPUTER /RU USER1 /RP neverguessme /TN FP-Win-Scan /SC DAILY /ST 23:00:00 /TR \\\"" & EnvGet("ProgramFiles") & "\FSI\F-Prot\FP-Win.exe /NORMAL=C:\\\"")

My assumption is that AutoIt should translate \\\" into \" which will then be passed to schtasks. Schtasks should then take the \" and translate that as " when inserting the string.

Unfortunately, AutoIt tells me it cannot parse the line.

Any ideas would be welcome. Thanks.

  • Developers
Posted

to make your live easy you can just put single quotes around the command like:

run('schtasks /create /S MYCOMPUTER /RU USER1 /RP neverguessme /TN FP-Win-Scan /SC DAILY /ST 23:00:00 /TR "\"C:\Program Files\FSI\F-Prot\FP-Win.exe\" /NORMAL=C:"')

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Awesome. Works.

After lurking and reading other posts, I was impressed with response speed and quality on this forum. I wish the other forums I frequent were 1/10th as useful as this one. :lmao:

Now onto the rest of the script. o:) Trying to automate an antivirus install and customize it the way we want for mass remote functionality. :)

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...