Search code examples
batch-filecmdwindows-xp-sp3system32

Why do MKDIR and DIR still work when XCOPY doesn't?


I recently encountered an error where XCOPY wouldn't work in a batch file returning:

'xcopy' is not recognized as an internal or external command, operable program, or batch file.

Several other commands (ie: HELP) returned the same error, which I discovered was due to where %SYSTEMROOT%\SYSTEM32 was defined in the path variable. It was burried in the middle, but moving it to the beginning fixed this issue.

I do not understand why other commands (ie: MKDIR in the same batch file) are still recognized when the other commands aren't. Are these defined elsewhere in the OS in a way that makes them always accessable?

Setup is Windows XP Professional 2002 SP3, 32-Bit running in Oracle VM VirtualBox.


Solution

  • MKDIR and DIR are cmd.exe internal commands and are not separate executable files. Here you can find the fill list of the internal commands:

    ASSOC, BREAK, CALL ,CD/CHDIR, CLS, COLOR, COPY, DATE, DEL, DIR, DPATH, ECHO, ENDLOCAL, ERASE, EXIT, FOR, FTYPE, GOTO, IF, KEYS, MD/MKDIR, MKLINK (vista and above), MOVE, PATH, PAUSE, POPD, PROMPT, PUSHD, REM, REN/RENAME, RD/RMDIR, SET, SETLOCAL, SHIFT, START, TIME, TITLE, TYPE, VER, VERIFY, VOL