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 Read
Name: trusp Date: January 12, 2009 at 00:03:11 Pacific OS: DOS CPU/Ram: Intel DUO Product: Ms / Ms/e6550 Subcategory: Batch
Comment:
Hi
Help me in this issue
@echo on set Path=C:\Temp.txt for /f "eol=; tokens=1 delims=" %%i in (%Path%) do (set /a no=%%i+1) echo First %no% set no=1 echo %no%> %Path% for /f "eol=; tokens=1 delims=" %%i in (%Path%) do (set /a no1=%%i+1) echo Final %no1%
Here I am trying to read a number from file and after that trying to set it as 1. But its setting as "ECHO is on".
I cant find the reason for it. set no=1 echo %no%> %Path%
Name: Judago Date: January 12, 2009 at 01:19:20 Pacific
Reply:
You shouldn't use a variable called "path" path is a system variable that tells the cmd where to look for executable files like find ect. For a list of variables that are not a good idea to use start a new cmd prompt and type in "set". In general terms everything to the left of the "=" should probably not be used.
Now your actual problem may be further down the line, perhaps in the text file. What is in the text file? You need to give an example to make things easier.
Another problem that springs to mind is this line:
echo %no%> %var%
Obviously you don't want a trailing space but since you variable ends in a number cmd may be interpreting your variable as handle redirection. Try this instead:
>%var% echo %no%
I change the variable because of what I mentioned above.
0
Response Number 2
Name: reno Date: January 12, 2009 at 01:36:59 Pacific
Reply:
echo ^2>num.txt set /p no_1st=<num.txt set /a no_1st+=1
Summary: Using Batch file(.bat Dos based) I have to read a text file(temp.txt) containing data as the following: #,User,Password,Feed,Capacity Trusp,doit123,DNR,25 #,Thamba,ert23,IRR,30 #,Andrew,,,, Using batc...
Summary: I'm trying to make a relatively simple program but I can't remember what to do to get it to work. What I basically want it to do is read in information from an external file that contains characters a...
Summary: Hey, I have almost no knowledge about programming and I have an old dos file that I need to "break" into. The company that made the software is of course out of business and I can't get the file to ru...