9

When I execute a command with the same name as an internal command, instead of searching in the path Windows simply uses the one found in CMD.EXE.

For example, MKDIR is an internal command built into CMD.EXE. It does not support the same options as the Unix version (e.g. -p and --help). If I use these options Windows will simply create files named -p or --help even though I have the GNU version of mkdir installed in a directory in my path.

This becomes an issue when working with certain programs that use mkdir through the terminal. For example, the gulpfile for prose contains three mkdir -p commands that, create a folder -p in the working directory and then throw errors. I have to manually edit the gulpfile such that it uses the installed mkdir.exe, which makes it harder for me to share my fork cross-platform.

How can I force the Windows shell to use the mkdir.exe found in PATH rather than CMD.EXE?

1 Answers1

14

How can I force the Windows shell to use the mkdir.exe found in PATH rather than CMD.EXE?

Surround the executable name in double-quotes. For example:

"MKDIR"

This forces Windows to look for your executable instead of running the internal command. If you have parameters that also require double-quotes, use this syntax:

"MKDIR" -firstParam "C:\foobar\long file name.ext"