when I try to enter the C: root, it goes to C: \ Users \ PC1>
so I've tried pressing E: so it goes to E:>
when I saw press C: so it goes to C: \ Users \ PC1> again,
it has worked until today, but now it does not work, why would it not now,
I have tried to restart the computer but it still does not work.

I have tried the following commands
c: it does not work
cd to go one directory back, does not work
in E: it works

soumphair commented: cmd +0

Dani AI

Generated

A quick way to always land at C:\ (no matter which drive you are on or what your last folder was) is to use pushd. You can also check whether something is auto-changing your start folder.

Try these, copy/paste one line at a time:

where cmd
pushd C:\
popd
doskey croot=pushd C:\
reg query "HKCU\Software\Microsoft\Command Processor" /v AutoRun
reg query "HKLM\Software\Microsoft\Command Processor" /v AutoRun
cmd /d

Notes:

  • pushd C:\ jumps straight to C:\ and also switches drives. popd takes you back.
  • doskey croot=pushd C:\ gives you a quick shortcut: type croot to jump to C:\ in this session.
  • If either AutoRun value exists, a startup command may be changing your directory; launch with cmd /d to ignore it.
  • To start every new prompt at C:\, right‑click your Command Prompt shortcut, Properties, and set Start in: C:\. Or create a shortcut that runs: cmd.exe /k pushd C:\.

Two sanity checks that often explain the behavior change:

  • Are you in PowerShell instead of Command Prompt? PowerShell shows a prompt like PS C:\>. If so, run cmd or use Set-Location C:\.
  • Did you open the prompt as Administrator? That typically starts in C:\Windows\System32. You can still jump to C:\ using the commands above.

For background on why a single drive letter does not guarantee the root, see ’s explanation below and then use the tools here to force exactly where you want to be.

Recommended Answers

All 7 Replies

i think "cd .." command for going back

cd.. will move up one parent directory and cd\ will move to the root directory.

type again C:

C: has worked but it does not work now,
when I try E: it works

Now have a friend solved the problem, he says there was an error in windows
but thanks for the answers :)

No error in your Windows - that is how cmd works. It remembers the last path in any drive. If from c: you enter e: you are not giving it any real directory to go to, so if you have not previously [in this cmd session] been to the e: drive then you will get e:\ ie e: root. If you then cd to e:\folder, then enter c: you will go back to the path you last used in c: [the default start directory is c:\Docs n Setts\You]. Entering e: again will take you back to e:\folder. e: is not a particular path instruction, it simply changes the drive to the last path used there.
It's how it is. And to jump to a deeper path in a new drive you must use /d parameter. So from c: you would enter cd /d d:\"other folder"
And cd \ takes you to the root of the drive you are in. If you are in c:\folderofstuff, entering cd \ is the same as entering cd c:\ It's what you would expect.
With markdown, pay attention to what you are typing.... you don't always get what you expect. To get c:\ to print you must type c:\\ ; typing c:\ will just get you c:. But if there is a space beeween the c: and the \ then you get your c: \ as you type it.
Sheesh.
Really. Sheesh.

your welcome ^_^

you can mark this as solved...

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.