hi
am unable to chage directory in windows server command prompt ie for example
cd C:Program Files

i am getting the error as " A positional parameter cannot be found that accepts argument 'Files'. "

can you please help with correct way
thanks in advance

Dani AI

Generated

The error text shown—“A positional parameter cannot be found that accepts argument 'Files'.”—is the PowerShell parameter‑binding message (Set‑Location), not a native cmd.exe response. That explains why suggestions already posted by and (using quoted paths or the 8.3 short name) work: PowerShell parses unquoted words as separate parameters, so a path with spaces will be split by the parser. (stackoverflow.com)

How to distinguish the shells: PowerShell prompts normally start with “PS …>”, while the classic Command Prompt shows just the path and >. Running the legacy Command Prompt (cmd.exe) produces the older cd behaviour (including the /D switch to change drives) described in Windows command docs; that is why directory syntax/drive handling can seem different between the two environments. (learn.microsoft.com)

If staying in PowerShell, use the PowerShell navigation primitives rather than expecting exact cmd semantics. cd is an alias of Set-Location; the -LiteralPath form avoids wildcard/interpretation surprises, and the location stack pattern is useful for temporary context changes. For example, the push/pop pattern (aliases pushd / popd) makes scripts and ad‑hoc work cleaner:

pushd <path>
... work in that location ...
popd

Documentation for Set‑Location and Push‑Location covers these behaviors and parameters. (pdq.com)

Common gotchas beyond plain spaces: missing or misplaced backslashes after a drive letter, doubled spaces or stray punctuation inside a path, or an alias/function that changes parsing rules (as hinted about drive/path semantics). PowerShell’s parsing rules (argument mode, quoting, stop‑parsing token) explain most of these cases; using the appropriate shell or the -LiteralPath/pushd pattern resolves the vast majority of “positional parameter” errors. (learn.microsoft.com)

Recommended Answers

All 4 Replies

Because of the spans between the words, you will need to use quotes.

Try cd "program files"

'cd \progra~1' works as well. You can also type cd \progra then hit the TAB key to autofill the rest.

If you do not add the \ after c: or whatever drive you are working in, the command will not work. It is easier to just drop the drive name all together, and just do the following as an example "\Program Files" without the quotes.

Now there is of course Midnight Commander for Windows http://sourceforge.net/projects/mcwin32/ which allows you to work in folders, or move files across folders or drives, or Double Commander http://sourceforge.net/projects/doublecmd/?source=recommended or Total Commander http://www.ghisler.com/ Another is WinSCP http://winscp.net/eng/index.php

Windows Command window is too crippled, for some of the stuff that needs to be done, especially when it comes to working with servers.

thanks a lot

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.