0

In trying to move to a folder called "Creating Project & External Execution"... with this command...

cd Creating Project & External Execution

This error occurs...

The system cannot find the path specified.
'External' is not recognized as an internal or external command, operable program or batch file.

Why does External in the folder name cause this problem?

5
  • Welcome to SuperUser. Can you post a screenshot of the typed command before you press return?
    – Stese
    Commented May 15, 2017 at 13:04
  • 1
    It's not the 'External' that's causing the problem, it's the &, which has a special meaning to CMD. You may find this SS64 reference page useful. Commented May 15, 2017 at 13:09
  • The folder name has to be inside double quotes " " to be reading spaces. For example cd "Program Files"
    – me_alok
    Commented May 15, 2017 at 13:16
  • @me_alok cd Program Files work as well. cd doesn't need quotes for file name with spaces. cd /? gives this CHDIR command does not treat spaces as delimiters, so it is possible to CD into a subdirectory name that contains a space without surrounding the name with quotes The only problem here is the &.
    – phuclv
    Commented May 15, 2017 at 15:13
  • @LưuVĩnhPhúc Thank you, i guess i usually followed what tab key said. The tab audo-completion adds quotes which made me think it does require quotes.
    – me_alok
    Commented May 15, 2017 at 15:41

3 Answers 3

4

Of course it does. The command you must issue is:

cd "Creating Project & External Execution"

In this screenshot, you see that I have first issued your command, and then the one I recommended above, as well the results of each.

Your command vs. my command

The command that you are issuing is equal to the following two commands:

cd Creating Project
External Execution

The first results in this error:

The system cannot find the path specified.

And the second results in this error:

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

0

In Windows cmd & is a special character used for separating multiple commands on a single line

& [...]     command1 & command2       

Use to separate multiple commands on one command line. Cmd.exe runs the first command, and then the second command.

Command shell overview

As a result cd Creating Project & External Execution will be executed as

cd Creating Project
External Execution

as Fleet Command said. Since there's no folder called "Creating Project" and no command named External, you got the above errors.


To solve this you have to escape the & somehow. There are 2 ways:

  • Put quotes around the name because inside quotes & loses its special meaning

    If it is a quote (") toggle the quote flag, if the quote flag is active, the following special characters are no longer special: ^ & | < > ( ).

    How does the Windows Command Interpreter (CMD.EXE) parse scripts?

    cd "Creating Project & External Execution"
    
  • Escape with ^

    cd Creating Project ^& External Execution
    

No need to escape the spaces because cd works fine with spaces in filename1. But if you want you can still escape the spaces like this cd Creating^ Project^ ^&^ External^ Execution without problem

cmd


1Space is not a delimiter in cd

C:\>cd /?
Displays the name of or changes the current directory.

CHDIR [/D] [drive:][path]
CHDIR [..]
CD [/D] [drive:][path]
CD [..]

  ..   Specifies that you want to change to the parent directory.

...

CHDIR command does not treat spaces as delimiters, so it is possible to
CD into a subdirectory name that contains a space without surrounding
the name with quotes.  For example:

    cd \winnt\profiles\username\programs\start menu

is the same as:

    cd "\winnt\profiles\username\programs\start menu"

which is what you would have to type if extensions were disabled.
-1

You have to put the folder name between quotation mark " and ", that will be like that :

cd "your folder name"
1
  • you don't need to put folder name in quotes. cd some folder absolutely works without problem. The problem here is the & character
    – phuclv
    Commented May 15, 2017 at 15:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .