Computing.Net > Forums > Programming > dos file size command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

dos file size command

Reply to Message Icon

Name: agt6381
Date: October 27, 2009 at 09:09:32 Pacific
OS: Windows XP
CPU/Ram: intelDuo 2g
Product: Microsoft Windows xp professional edition
Subcategory: Batch
Tags: DOS
Comment:

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)
: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
:startCMS
net start CMSService
eof



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 28, 2009 at 02:51:21 Pacific
Reply:

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

M2


0

Response Number 2
Name: klint
Date: October 28, 2009 at 10:17:39 Pacific
Reply:

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 /?


0

Response Number 3
Name: Razor2.3
Date: October 29, 2009 at 08:50:53 Pacific
Reply:

I remember doing this. I don't remember if it worked:

(net stop someService || net start someService) 2>NUL


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: dos file size command

DOS file search at command prompt www.computing.net/answers/programming/dos-file-search-at-command-prompt/18072.html

Batch - adding file sizes www.computing.net/answers/programming/batch-adding-file-sizes/16624.html

file size check and error in file www.computing.net/answers/programming/file-size-check-and-error-in-file/18261.html