[Batch] String Extraction
Solved
jejeTech
Posted messages
83
Status
Membre
-
logon313 Posted messages 50 Status Membre -
logon313 Posted messages 50 Status Membre -
Hi,
I have a problem with manipulating a string. I have a file (temp2.txt) that contains a string of characters like this:
1:4162
What I want to do is extract the number "4162" to temporarily place it in a variable. I am using the FOR command to achieve this.
Here is the line that should allow me to perform this extraction:
FOR /F "eol=: tokens=1 " %i in temp2.txt do @echo %i
Thank you in advance for your help.
I have a problem with manipulating a string. I have a file (temp2.txt) that contains a string of characters like this:
1:4162
What I want to do is extract the number "4162" to temporarily place it in a variable. I am using the FOR command to achieve this.
Here is the line that should allow me to perform this extraction:
FOR /F "eol=: tokens=1 " %i in temp2.txt do @echo %i
Thank you in advance for your help.
In a FOR loop when you run the command directly, there is 1 % in front of your variable, for example %i
But when you put this loop in a Batch file, you need to use it twice, so %%i
That's all.