Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
Batch problem!
Name: Dejan Jovanovic Date: November 9, 2001 at 03:22:32 Pacific
Comment:
Can anybody explain why this doesn't work? It's simple, just counts the lines in a file. Stupid program just writes 0 in the loop and in the end the correct number.
set /a line=0 for /f %%i in (userstmp.txt) do ( set /a line += 1 echo %%i %line% ) echo %line%
Name: DoOMsdAY Date: November 9, 2001 at 03:33:25 Pacific
Reply:
I'm guessing because all variables in Batch are strings (reason number 1) and Batch has absolutely no Math operations available to it (reason number 2). Unless you want some highly convoluted program to achieve that, I'd suggest just writing it in QuickBASIC or something similar.
0
Response Number 2
Name: astroraptor Date: November 9, 2001 at 04:23:34 Pacific
Reply:
It's been done before though. In pure batch.
Try this site: http://www.accesscomm.ca/users/gbraun/batch/
0
Response Number 3
Name: Laurence Date: November 20, 2001 at 01:40:30 Pacific
Reply:
First, Math operations _can_ be done in batch, although it is exceedingly difficult to understand.
Second, That is a NT batch so the OP is in the wrong place.
0
Response Number 4
Name: Marcus Date: November 23, 2001 at 01:07:01 Pacific
Reply:
Hi!
Under NT, W2K or XP this Batchfile should work. But your line set /a line += 1 should go like this: set /a line="line+1"
And please be aware, that it DOESNT work under a DOS System! GREETS Marcus
Summary: I am taking an online class in DOS, and, unfortunately, the last problem is way over my head. Here's what I have to do: Create a simple menu system to help someone with DOS commands. It is to be a ...
Summary: I'm learning DOS online - have a question on a batch file I have to write. The file is supposed to display the message "Hit ENTER to get a directory listing of your diskette." Then PAUSE and wait fo...
Summary: I have the following batch file :MENU @ECHO OFF CLS ECHO IP CONFIGURATION MENU ECHO. ECHO 1. RELEASE IP ADDRESS ECHO 2. RENEW IP ADDRESS ECHO 3. VIEW CURRENT IP CONFIGURATION ECHO 4. EXIT ECHO. CHOICE...