I think I have a simple problem. I have a file where I'm trying to format the output into columns. I think I found a way to do it here but the string1 and string2 variables are not setting. Any ideas? I'm not familiar with Windows scripting and come from Linux where it's much easier.
Make this:
San Disk USB Drive, 10-12-2013
Superdrive Disk USB Drive, 10-11-2013
look like this:
San Disk USB Drive 10-12-2013
Superdrive Disk USB Drive 10-11-2013
Code I'm using to read the text file:
FOR /F "usebackq delims=" %%a in (`"findstr /n ^^ temp_sorted_usb_history.txt"`) do (
set "var=%%a"
SETLOCAL EnableDelayedExpansion
set "var=!var:*:=!"
echo(!var!
for /F "tokens=1,2 delims=," %%b in ("!var!") do (
echo %%b%%c
set string1=%%b
set string2=%%c
set string1="%string1% "
set string2="%string2% "
echo !string1:~-40! !string2:~-40!
)
ping -n 4 -w 1 127.0.0.1 >NUL
ENDLOCAL
)
The problem is that I can't get the string variables to set.