Hello!

I run a script using the Windows Task Scheduler with this comand line in
the job MyTask.job
wscript "d:\myscript.vbs"

That's fine!
But how can I know the name of the task who call the script? (in this
example, it would be MyTask.job).
I think I can use the log file of the Sheduler but does anyone know
another way to do this inside myscript.vbs ?

Thanks

Re: Task Scheduler & VBS by Franz_aRTiglio

Franz_aRTiglio
Wed Dec 13 09:49:09 CST 2006

Claude (F wrote:

> I run a script using the Windows Task Scheduler with this comand line in
> the job MyTask.job
> wscript "d:\myscript.vbs"
>
> That's fine!
> But how can I know the name of the task who call the script? (in this
> example, it would be MyTask.job).
> I think I can use the log file of the Sheduler but does anyone know
> another way to do this inside myscript.vbs ?

any job should call the script with a parameter, then the script will write
somewhere the parameter (maybe plus date and time).
(google for WScript.Arguments)

So if the script will be called from different jobs eg.

MyTask.job --> myscript.vbs MyTask
anothertask.job --> myscript.vbs anothertask
blahblah.job --> myscript.vbs blahblah

then myscript will read the parameter and
write it in a text/log/whatever.





Re: Task Scheduler & VBS by Claude

Claude
Wed Dec 13 11:28:56 CST 2006

Franz_aRTiglio a écrit :
> Claude (F wrote:
>
>> I run a script using the Windows Task Scheduler with this comand line in
>> the job MyTask.job
>> wscript "d:\myscript.vbs"
>>
>> That's fine!
>> But how can I know the name of the task who call the script? (in this
>> example, it would be MyTask.job).
>> I think I can use the log file of the Sheduler but does anyone know
>> another way to do this inside myscript.vbs ?
>
> any job should call the script with a parameter, then the script will write
> somewhere the parameter (maybe plus date and time).
> (google for WScript.Arguments)
>
> So if the script will be called from different jobs eg.
>
> MyTask.job --> myscript.vbs MyTask
> anothertask.job --> myscript.vbs anothertask
> blahblah.job --> myscript.vbs blahblah
>
> then myscript will read the parameter and
> write it in a text/log/whatever.
>
>
>
>
thanks, i will try that