Link to home
Create AccountLog in
Avatar of Lou Pereira
Lou PereiraFlag for United States of America

asked on

Run TASK scheduler on demand

I created a script to run a task already defined in task scheduler on demand.  I would like to use VBScript as I can compile to an exe and encrypt the id and password.  Any help would be great.  Thanks
set objShell = CreateObject("WScript.Shell") "cmd.exe /C ""SCHTASKS /Run /S servername /U halcyon\uswername /P password" & " /I" & " /TN" & " \Exports\Bank of eden (qqq) file Export"""

Thank you for your help
Avatar of Lofty Worm
Lofty Worm
Flag of United States of America image

Avatar of Lou Pereira


Thank you for the password info, but I am more interested in finding out why does the code I posted is not working.
BTW, it works from the command prompt if I type the following:
SCHTASKS /Run /S servername /U halcyon\username /P password /I /TN "\Exports\Bank of eden (qqq) file Export"
Ahh, I must have read it wrong.  
Have you tried replacing the " with ( ) or '
So, What is the error you are getting?
You compile it to exe right, then execute it and what happens?
Avatar of Qlemo
Flag of Germany image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
It appears the multiple quotes have been a problem for others.  I am sorry, I thought this was a different issue, but I will try to help anyway.  I dug this up, and it may help
I think you misspelled username

uswername "cmd.exe /C ""SCHTASKS /Run /S servername /U halcyon\uswername /P password" & " /I" & " /TN" & " \Exports\Bank of eden (qqq) file Export"""
Thank you for you kind help, much appreciated.  This was a simple request I am sure but you provided the correct answer the first time!  I was able to complete a critical and visible project.   Again thank you