notta Posted September 16, 2008 Posted September 16, 2008 (edited) Is there something I'm doing wrong? MsgBox(0,"","schtasks /create /sc hourly /tn Scan /mo 2 /sd " & $startDate & " /ed " & $endDate & " /tr " & $fileScanTool) $run = RunWait(@ComSpec & " /C schtasks /create /sc hourly /tn Scan /mo 2 /sd " & $startDate & " /ed " & $endDate & " /tr notepad.exe", @SW_HIDE) I'm banging my head against the desk. If I type this command into a command prompt it works fine. The message box displays everything correctly, but it's not adding the task into the scheduler. Any ideas? Edited September 16, 2008 by notta
DjDeep00 Posted September 16, 2008 Posted September 16, 2008 (edited) @notta..What is the format of your date? This works for me...Here you go... $Username="someusername" $Password="somepassword" $startDate="09/17/2008" $endDate="09/18/2008" RunWait(@ComSpec & " /c " & 'schtasks /create /sc hourly /ru ' & $Username & ' /rp ' & $Password & ' /tn Scan /mo 2 /sd ' & $startDate & ' /ed ' & $endDate & ' /tr notepad.exe', "", @SW_HIDE) Edited September 16, 2008 by DjDeep00
notta Posted September 16, 2008 Author Posted September 16, 2008 Thanks DJ. I forgot to put in the spacer for the workingdir parameter. Added the "" and it works fine now. Duh
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