I have a dos batch file.
mycommand.exe>c:\temp
find /B Serv c:\temp>c:\temp2
set /p var1=<c:\temp2
SET var2=%var1:~-7%
echo %var2%
This is only DOS, not windows environment.
The problem is that, the batch file output is: "Echo is ON". Can't echo the VAR2 variable.
mycommand.exe is a simple app. Not important.
> type c:\temp"
VERSION 45.2
TAG1 NUMBER is 1234567
Serv NUMBER is 9654754
> type c:\temp2
c:temp Serv NUMBER is 9654754
What can I do, If I would like echo the VAR2 variable? I can't use "setlocal enabledelayedexpansion" because setlocal "Command or filename not recognized".
Edit: What am I want exactly? I would like to ECHO mycommand.exe output 3rd line last 7 characthers. Thats all.
set
command does not support/p
. It also doesn't support substitution It's onlyset variable=value
– Stephanfind
has no/B
neither in DOS nor in Cmd. (you think offindstr
, which has the/b
, but it's not available in DOS) – Stephan