In the command, when selecting files, use %% instead of <EscapeChar>%. This is enough in the DIR command, and it will also report the file in the FOR ... ECHO command. However, in the latter, evaluating %i still has trouble. The FOR set the value of i to be the exact filename, %-signs included. However, the ECHO %i tries to evaluate the value of %i; at that point % signs in the filename itself are interpreted as introducing a variable name. A second % indicates the end of the variable name. If that string is numeric (e.g. %23%39) and you are executing a command at the command prompt, it will not be interpreted (unless you defined an environment variable with its name that number, e.g., set 23=goofed23goof). But if the command is executed in a batch file, OR if it is an alias, %23% is replaced with the value of the 23rd batch file or alias parameter, likely to be an empty string, so %23%39 will most likely be displayed as just 39! SETDOS /X-4 solves this problem, but using the variable %i as the parameter of another batch file or alias might still give you problems. Even Charles Dye's safechars.dll is not always capable to deal with % signs embedded in data. The command that worked here is this:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.