Kok Yong Lee
10-04-2005, 04:32 PM
Hi there,
I ouwld like to write a batch file that will kick start a schedule task on a
remote machine using the following command
schtasks /run /s cam2 /tn start_test
there will be a number of machines that I will have to start off the tests
in the batch file. How can I catch the return from this command "SUCCESS:
Attempted to run the scheduled task "test"", and act on them appropriately?
thanks.
Jerold Schulman
10-05-2005, 03:08 PM
On Tue, 4 Oct 2005 16:32:03 +0100, "Kok Yong Lee" <lkoky@hotmail.com> wrote:
>Hi there,
>
>I ouwld like to write a batch file that will kick start a schedule task on a
>remote machine using the following command
>
> schtasks /run /s cam2 /tn start_test
>
>there will be a number of machines that I will have to start off the tests
>in the batch file. How can I catch the return from this command "SUCCESS:
>Attempted to run the scheduled task "test"", and act on them appropriately?
>
>thanks.
>
>
for /f "Tokens=1*" %a in ('schtasks /run /s cam2 /tn start_test') do (
if "%%a" EQU "SUCCESS: " (call :suc "%%b") ELSE (call :not "%%b)
)
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
Kok Yong Lee
10-10-2005, 12:08 PM
Thanks Jerold,
BTW, where can I find more informatino about the "Tokens=1*" usage in the
example you showed me?
thanks again
"Jerold Schulman" <Jerry@jsiinc.com> wrote in message
news:p9n7k1tbdr4pocag0fu254l4pknpgr6g34@4ax.com...
> On Tue, 4 Oct 2005 16:32:03 +0100, "Kok Yong Lee" <lkoky@hotmail.com>
> wrote:
>
>>Hi there,
>>
>>I ouwld like to write a batch file that will kick start a schedule task on
>>a
>>remote machine using the following command
>>
>> schtasks /run /s cam2 /tn start_test
>>
>>there will be a number of machines that I will have to start off the tests
>>in the batch file. How can I catch the return from this command "SUCCESS:
>>Attempted to run the scheduled task "test"", and act on them
>>appropriately?
>>
>>thanks.
>>
>>
>
> for /f "Tokens=1*" %a in ('schtasks /run /s cam2 /tn start_test') do (
> if "%%a" EQU "SUCCESS: " (call :suc "%%b") ELSE (call :not "%%b)
> )
>
> Jerold Schulman
> Windows Server MVP
> JSI, Inc.
> http://www.jsiinc.com
> http://www.jsifaq.com
billious
10-10-2005, 01:01 PM
"Kok Yong Lee" <lkoky@hotmail.com> wrote in message
news:ezegErYzFHA.3180@TK2MSFTNGP14.phx.gbl...
> "Jerold Schulman" <Jerry@jsiinc.com> wrote in message
> news:p9n7k1tbdr4pocag0fu254l4pknpgr6g34@4ax.com...
>> On Tue, 4 Oct 2005 16:32:03 +0100, "Kok Yong Lee" <lkoky@hotmail.com>
>> wrote:
>>
>>>Hi there,
>>>
>>>I ouwld like to write a batch file that will kick start a schedule task
>>>on a
>>>remote machine using the following command
>>>
>>> schtasks /run /s cam2 /tn start_test
>>>
>>>there will be a number of machines that I will have to start off the
>>>tests
>>>in the batch file. How can I catch the return from this command "SUCCESS:
>>>Attempted to run the scheduled task "test"", and act on them
>>>appropriately?
>>>
>>>thanks.
>>>
>>>
>>
>> for /f "Tokens=1*" %a in ('schtasks /run /s cam2 /tn start_test') do (
>> if "%%a" EQU "SUCCESS: " (call :suc "%%b") ELSE (call :not "%%b)
>> )
>>
>> Jerold Schulman
>> Windows Server MVP
>> JSI, Inc.
>> http://www.jsiinc.com
>> http://www.jsifaq.com
>
> Thanks Jerold,
>
> BTW, where can I find more informatino about the "Tokens=1*" usage in the
> example you showed me?
>
> thanks again
>
From the prompt, type
FOR /?
(for that matter, SET/? or CALL/? yield interesting information - or in
general, command/? )
The newsgroups alt.msdos.batch or more especially alt.msdos.batch.nt (for
NT/2K/XP) are dedicated to the use of batch in strange and wonderful ways.
HTH
....Bill
Jerold Schulman
10-10-2005, 01:07 PM
I trust Bullious's answer was sufficient.
On Mon, 10 Oct 2005 12:08:32 +0100, "Kok Yong Lee" <lkoky@hotmail.com> wrote:
>Thanks Jerold,
>
>BTW, where can I find more informatino about the "Tokens=1*" usage in the
>example you showed me?
>
>thanks again
>
>"Jerold Schulman" <Jerry@jsiinc.com> wrote in message
>news:p9n7k1tbdr4pocag0fu254l4pknpgr6g34@4ax.com...
>> On Tue, 4 Oct 2005 16:32:03 +0100, "Kok Yong Lee" <lkoky@hotmail.com>
>> wrote:
>>
>>>Hi there,
>>>
>>>I ouwld like to write a batch file that will kick start a schedule task on
>>>a
>>>remote machine using the following command
>>>
>>> schtasks /run /s cam2 /tn start_test
>>>
>>>there will be a number of machines that I will have to start off the tests
>>>in the batch file. How can I catch the return from this command "SUCCESS:
>>>Attempted to run the scheduled task "test"", and act on them
>>>appropriately?
>>>
>>>thanks.
>>>
>>>
>>
>> for /f "Tokens=1*" %a in ('schtasks /run /s cam2 /tn start_test') do (
>> if "%%a" EQU "SUCCESS: " (call :suc "%%b") ELSE (call :not "%%b)
>> )
>>
>> Jerold Schulman
>> Windows Server MVP
>> JSI, Inc.
>> http://www.jsiinc.com
>> http://www.jsifaq.com
>
Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com