Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine how script was launched 1

Status
Not open for further replies.

withanh

IS-IT--Management
Dec 17, 2008
221
0
0
US
I'm trying to determine how a script was launched then run a sub based on this.

For example, if a script was launched by Task Scheduler then write a line into a log file saying 'scheduled launch' but if it was run manually then write a different line into the log file saying 'manual launch'.

The only part I need help with is determining how the script was launched, and I really have no idea how to do that.

If there's no flags I can check, then I'm thinking of adding an argument to the scheduled task and do a check like:
if args > 0 then SubX else SubY

Any thoughts or suggestions would be appreciated!

Thanks,

h
 
Add an argument to the scheduled task and then play with the WScript.Arguments collection

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks. That's pretty much what I was thinking. I wasn't sure if there was a better 'native' way to tell what launched the script.

h
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top