Jump to content
Sign in to follow this  
kodius

RunWait SCHTASK syntax wrong

Recommended Posts

kodius

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")

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
kodius

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?

Share this post


Link to post
Share on other sites
Flash1212

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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.