Dos Batch File

reicherb

Platinum Member
Nov 22, 2000
2,122
0
0
I'm trying to increment a dos batch file variable. How do I do it?

SET B:=+1 isn't working.

Help please.

Thanks.
 

SoulAssassin

Diamond Member
Feb 1, 2001
6,135
2
0
Here's a batch file I wrote that uploads my SETI packets via for loop. Each packet is in a numbered directory so it starts w directory 1 (var START) and moves to dir 50 (var MAX). The SETI stuff is irrelevent to what you're doing but the for loop should serve your purpose.

Give me more specifics of what you're trying to do and I'll try to help.

rem echo off

set START=1
set MAX=50
set QUEUE=1

for /l %%i in (%START%,1,%MAX%) do (
copy c:\work_seti\seti.exe c:\work_seti\%QUEUE%\%%i\seti.exe
cd\work_seti\%QUEUE%\%%i\
seti.exe -stop_after_xfer
del c:\work_seti\%QUEUE%\%%i\seti.exe
)
 

mobly99

Senior member
Apr 27, 2001
260
0
0
here is another easy one

@echo off
:A
set /a test=test+1
echo %test%
if %test% GTR 5 goto end
GOTO A

:end
echo done
set test=
 

reicherb

Platinum Member
Nov 22, 2000
2,122
0
0
I'm trying to script a process of parsing some log files. The logs are generated daily and I would like to parse them weekly.

The command line I'm using is:
script.bat 020301 020302 020303 020304 020305 020306 020307 (where the arguments are the filenames). The filenames are the file dates. I'd rather not have to enter all of the arguments and was hoping to increment the date. I know it's not that easy and that I'll have to do some kind of testing to make sure I don't try to read February 31 or some other date that doesn't exist.

Any ideas hoe to do all of this? I know perl or C would be better but my skills are pretty dull and I don't have either readily available.

Thanks.

Here is the beginning of the script:
@ECHO OFF
ECHO Start of HS/MS
L:\
cd\
ECHO Processing HS/MS File 1 of 7
Brdstats.exe %1.log
rename %1.log %1.txt
rename Brdboth.dbf %1Brdboth.xls
rename Brdip.dbf %1Brdip.xls
rename Brdurl.dbf %1Brdurl.xls
rename Brdusr.dbf %1Brdusr.xls

ECHO Processing HS/MS File 2 of 7
rename %1.log %1.txt
Brdstats.exe %2.log
rename Brdboth.dbf %2Brdboth.xls
rename Brdip.dbf %2Brdip.xls
rename Brdurl.dbf %2Brdurl.xls
rename Brdusr.dbf %2Brdusr.xls

Continues on repeating.
 

NaturalChiller

Senior member
Jun 27, 2001
292
0
0
I have a batch file question: I'd like to be able to simply type j <filename> in a cmd window and have the batch file run 'javac' and 'java' upon the file,,,how do I go about doing this? I know j.bat needs to be in c:\winnt, but i'm not sure about the syntax of the batch file since javac operates on a *.java file and 'java' does not.