In DOS, I am trying to take the output from a command and assign it to a variable, then take the output and truncate the first two lines of the string. Here is a snippet of what I am trying to do:
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
for /f "tokens=* delims= " %%a in ('net view') do (
set SERVER= %%a
set SERVER=%SERVER:~2
echo SERVER is SERVER
)
The output of the 'net view' command will list the servernames on my network. I want to remove the double blackslashes at the beginning of the string. I haven't had any luck using the truncation operation on the %%a
variable. Is that possible, and if not how can I assign %%a
to another variable to do the truncation on that instead? If there is another option to do this, I am also open to that as well.