Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
miskox
- Posts: 630
- Joined: 28 Jun 2010 03:46
#1
Post
by miskox » 08 Nov 2022 11:01
Hello all!
This code
Code: Select all
@echo off
set var=0001
for /f "tokens=* delims=0" %%~ in ("%var%") do set var=%%~
echo %var%x
Result on Windows 10:
Result on XP:
works on Windows 10 but not on XP. Any ideas why?
It removes leading zeroes.
Thanks.
Saso
(This approach is here:
viewtopic.php?f=3&t=8136)
-
aGerman
- Expert
- Posts: 4678
- Joined: 22 Jan 2010 18:01
- Location: Germany
#2
Post
by aGerman » 08 Nov 2022 14:08
Usually the ~ introduces modifiers in FOR variables. Do you see the same behavior with a letter as variable name?
Steffen
-
miskox
- Posts: 630
- Joined: 28 Jun 2010 03:46
#3
Post
by miskox » 08 Nov 2022 14:16
You were right - though I think I tried that and I think it didn't work. I replaced '~' with a letter and it works.
Thanks.
Saso