I need to brake a variable into two base on slash \
delimiter and then set the second value to a variable and print it in a file. Here is my code
set string=somestuff\needthis\ok
If NOT "%string%"=="%string:somestuff=%" (
for /f "tokens=1,2 delims=\" %%a in ("%string%") do (set "mystuff=%%b"
echo %mystuff% >> myfile.txt
)
) else (
echo No >> myfile.txt
)
Problem Point : if I directly echo %%b
then that will be printed in myfile.text
but if I assign it to variable and then try to echo the variable value it don't print anything.