Batch removing spaces deletes everything
Go to solution
Solved by PlutoNZL,
15 minutes ago, OTheB said:Yep I did realise that. Now I have something like this (the actual code I'm working with):
@echo off :start cd %~dp0 for /f "tokens=*" %%G in (file.txt) do ( set in=%%G set in=%in: =% echo %in% ) pauseWhat is interesting is that if I look at the output with echo on, both the space removing command and the echo command don't behave as they should. The set command just sets %in% to be " =", then the echo does literally nothing. If I move them outside the parentheses, suddenly they both work, but only on the last line as that is what %in% is set to be last. These commands seem to be behaving differently whether they are inside or outside the loop, which is really confusing me.
Check this: http://stackoverflow.com/questions/13805187/how-to-set-a-variable-inside-a-loop-for-f
SETLOCAL ENABLEDELAYEDEXPANSION @echo on :start cd %~dp0 for /f "tokens=*" %%G in (file.txt) do ( set in=%%G set in=!in: =! echo !in! ) pause
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now