Jump to content

RunWait SCHTASK syntax wrong


kodius
 Share

Recommended Posts

RunWait("schtasks /create /RU "username" /RP" & $user_password_input & "/TN "System Cleanup" /TR ""C:\Progra~1\ccleaner\ccleaner.exe" /AUTO" /SC daily /ST 19:30:00")

Possibly

RunWait('schtasks /create /RU "username" /RP' & $user_password_input & '/TN "System Cleanup" /TR "C:\Progra~1\ccleaner\ccleaner.exe" /AUTO /SC daily /ST 19:30:00')

but who knows because I have no idea what schtasks is and your post is not exactly, er, verbose ^_^

To get it correct I think you should do this

Get what you want at the command prompt. Save that command line.

The use ConsoleWrite instead of RunWait and chnage it untill it gives the same as the command that worked at the command prompt. Then change ConsoleWrite for RunWait.

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.
Link to comment
Share on other sites

Possibly

RunWait('schtasks /create /RU "username" /RP' & $user_password_input & '/TN "System Cleanup" /TR "C:\Progra~1\ccleaner\ccleaner.exe" /AUTO /SC daily /ST 19:30:00')

but who knows because I have no idea what schtasks is and your post is not exactly, er, verbose ^_^

To get it correct I think you should do this

Get what you want at the command prompt. Save that command line.

The use ConsoleWrite instead of RunWait and chnage it untill it gives the same as the command that worked at the command prompt. Then change ConsoleWrite for RunWait.

schtask schedules Windows XP, Vista, 2003, 2008 tasks. I'm trying to schedule ccleaner to run once a day and cleanup userland garbage after they leave for the day to keep the PCs clean.

I just can't seemt o get the syntax write... Has anyone used schtask with ccleaner, it's the $user_password_input I'm troubled by?

Link to comment
Share on other sites

schtask schedules Windows XP, Vista, 2003, 2008 tasks. I'm trying to schedule ccleaner to run once a day and cleanup userland garbage after they leave for the day to keep the PCs clean.

I just can't seemt o get the syntax write... Has anyone used schtask with ccleaner, it's the $user_password_input I'm troubled by?

I've done a bit of task scheduling at my job.

I believe that like /RU /RP requires a space before the actual value. Notice the space in /RP ' also the space before /TN.

RunWait('schtasks /create /RU "username" /RP ' & $user_password_input & ' /TN "System Cleanup" /TR "C:\Progra~1\ccleaner\ccleaner.exe" /AUTO /SC daily /ST 19:30:00')

Alternative the system account can easily take care of this task.

RunAs($Username, @ComputerName, $Password,0,'schtasks.exe /create /ru system /tn "System Cleanup" /sc Daily /st 19:30:00 /tr "C:\Progra~1\ccleaner\ccleaner.exe"', 'c:\WINDOWS\system32\', @SW_HIDE)

Hope this helps.

Edited by Flash1212

**The only limit is what you believe they tell you it is**

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...