dos file size command

Microsoft Windows xp professional editio...
October 27, 2009 at 09:09:32
Specs: Windows XP, intelDuo 2g
In advance excuss me if I dont make sense. I'm new to creating DOS bat files. I'm current trying to stop a service based on its state. Then writting a text file to be used for restart in the end of my bat file.
set service=cmsservice
for /f "tokens=3" %%a in ('sc query "%service%"^|find "STATE"') do (
if %cmsserviced%a==4 goto stop)
net stop cmsservice >> c:"\program files\motoplyr"\restart.txt

if /I %EQU==1kb% c:\startup.txt goto startcms
if /I %EQU==0kb% c:\startup.txt EQU==0kb goto eof

goto :startCMS
net start CMSService

See More: dos file size command

Report •

October 28, 2009 at 02:51:21
First DOS has nothing to do with XP.

Next, I don't have any "sc query" in win2000.

But if you post the output of that command, maybe I can muddle through the script.

Helping others achieve escape felicity


Report •

October 28, 2009 at 10:17:39
if %cmsserviced%a==4 goto stop

should be if %%a==4 goto stop

Next, think about what happens when %%a is not ==4. It will go to the next statement... which is the one labelled stop.

There are various other errors. I recommend you type the following and read the help text:

set /?
if /?
for /?

Report •

October 29, 2009 at 08:50:53
I remember doing this. I don't remember if it worked:
(net stop someService || net start someService) 2>NUL

Report •

Related Solutions

Ask Question