I need to call a batch file with a command I want it to execute. This command contains the %cd% pseudo-variable, which expands to the current directory. Say, I want to run test "echo %cd%"
. The problem is that %cd%
expands before test
is called.
Normally, you can escape a variable by doubling the percent signs, but this does not seem to apply to pseudo-variables. For instance, echo %%ProgramFiles%%
will print %ProgramFiles%
, but echo %%errorlevel%%
will print %0%
. What do I do?