Since the earliest Windows Commander versions, "%comspec% /c " is added for these commands:
dir
ren
del
copy
type
date
time
And also when the redirection symbols are used on the command line:
|
<
>
So because "dir" is in the list above, running this command works:
Code: Select all
dir & pause
Because "echo" is not in the list above, running this command results in a file not found message:
Code: Select all
echo ==Bare directory list== & dir /b & pause
Code: Select all
cmd /c echo ==Bare directory list== & dir /b & pause
Code: Select all
echo ==Bare directory list== & dir /b & pause & rem|
However, the implementation is not smart enough to omit adding "cmd.exe /c " when the user already added "cmd.exe /c" himself. So when you run this command:
Code: Select all
cmd.exe /c echo Writing bare directory list to file.. & (echo ==Bare directory list== & dir /b/s) > dirlist.txt & echo. & pause
Code: Select all
c:\WINDOWS\system32\cmd.exe /C cmd.exe /c echo Writing bare directory list to file.. & (echo ==Bare directory list== & dir /b/s) > dirlist.txt & echo. & pause

