Edit FOR Variable in CMD.exe

N

NvrBst

FOR %B IN (*.*) echo "%B"

Is there any way to edit the %B variable? I know the basic ones like
"%~nB" which will take just the name, or "%~pB" which will give the
path only, but say I want to remove the first character?

I know with Environment Variables I can do like the following to
remove just the first character, is there something like this for the
"%B" variable?:
set MYVAR=Hello.txt
echo %MYVAR:~1%


I'm using "cmd.exe" in Windows XP SP3. Thanks
 
P

Pegasus \(MVP\)

NvrBst said:
FOR %B IN (*.*) echo "%B"

Is there any way to edit the %B variable? I know the basic ones like
"%~nB" which will take just the name, or "%~pB" which will give the
path only, but say I want to remove the first character?

I know with Environment Variables I can do like the following to
remove just the first character, is there something like this for the
"%B" variable?:
set MYVAR=Hello.txt
echo %MYVAR:~1%


I'm using "cmd.exe" in Windows XP SP3. Thanks

You have to assign its current value to an env. variable before removing the
first character:
set MyVar=%b
echo %MyVar:~1%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top