processing string from file
Posted: 28 Feb 2012 22:11
I have been working (per request of a challenge) on a batch script to process a text file opened with it, and eventually want to renotate the .txt into batch
However, simply prep-ing the file for processing is throwing problems
I have two files comp.bat and text.txt
code.bat
text.txt
The current %'s has gotten the closest to what I want (to break the string into two, putting part 1 into variable a, and leaving the rest in inputFile for later processing), but instead, inputFile becomes %a%, when I want to remove that from the string, not make it equal it
However, simply prep-ing the file for processing is throwing problems
I have two files comp.bat and text.txt
code.bat
Code: Select all
@echo off
set /p inputFile=<%1
echo %inputFile%
for /f "tokens=1 delims=;" %%a in ("%inputFile%") do set a=%%a;&set inputFile=%inputFile:%%a%%="%
echo %inputFile%
echo %a%
pause
text.txt
Code: Select all
print ("Hello World!");this is pointless code;
The current %'s has gotten the closest to what I want (to break the string into two, putting part 1 into variable a, and leaving the rest in inputFile for later processing), but instead, inputFile becomes %a%, when I want to remove that from the string, not make it equal it