my command prompt defaulting to H drive and not changing to C drive

9

When i open my command prompt it defaults to my H drive and when i use cd /c: its not changing to the C drive. Please need help I have tried the following commands regsvr32 /u msolap.dll Thanks

user1768709

Posted 2016-04-21T15:58:53.503

Reputation: 109

2

Don't do cd /C: just do C: Example here

– DrZoo – 2016-04-21T16:06:28.383

1@DrZoo That only works if the current directory on c: is already \. The correct answer is to use cd /d c:\ – DavidPostill – 2016-04-21T16:12:04.597

"When i open my command prompt it defaults to my H drive" how are you opening your cmd prompt? – DavidPostill – 2016-04-21T16:13:04.667

Possible duplicate of Is it possible to run an old 16-bit DOS application under Windows 7 64-bit?

– Ani Menon – 2016-04-21T16:13:33.513

Answers

10

When I use cd /c: its not changing to the C drive.

Note that the command above is incorrect, it should be cd c:\ or c:/.

If you want to change the current drive in addition to changing directory use the /d option:

cd /d c:\

Use the /D switch to change current drive in addition to changing current directory for a drive.

Example:

F:\test>cd c:\

F:\test>rem drive doesn't change

F:\test>cd /d c:\

c:\>rem drive changes

cd usage

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.

Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.

Use the /D switch to change current drive in addition to changing current
directory for a drive.

If Command Extensions are enabled CHDIR changes as follows:

The current directory string is converted to use the same case as
the on disk names.  So CD C:\TEMP would actually set the current
directory to C:\Temp if that is the case on disk.

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.

Further Reading

DavidPostill

Posted 2016-04-21T15:58:53.503

Reputation: 118 938

Am using the following command REGSVR32 /u C:\Program Files\Microsoft Analysis Services\AS OLEDB\110 msolap 110.dll to unregister the msolap.dll file and am getting the error message "The module msolap110.dll" failed to load. Make sure the binary is stored at the specified path or debug it to check for the problems with the binary or dependent .dll files ,any idea – user1768709 – 2016-04-21T16:39:50.350

@user1768709 I don't know anything about that msolapp error :/ – DavidPostill – 2016-04-21T16:44:37.900

Perhaps looking at the command literally; perhaps you should place quotes around the path, like REGSVR32 /u "C:\Program Files\Microsoft Analysis Services\AS OLEDB\110 msolap 110.dll" because of the spaces. Or if the app is very old you may have to use the short version of the file names - listed with dir /X – reben – 2018-09-26T22:57:51.380

6

On your Start menu type cmd, then Command Prompt will be shown from the list. Right click it, select Properties.

Enter c: in the Start in field instead of %homedrive%%homepath%. Click ok.

Done.

Champ14

Posted 2016-04-21T15:58:53.503

Reputation: 61

1I dont have properties – Kalpesh Soni – 2018-06-12T18:41:29.740

From user Jimbo: if you just type c: in the "start in" box, when you open CMD it will default to c:\windows\system32. If you type c:\ instead, CMD will open to C:.

– fixer1234 – 2018-09-26T21:50:21.000

1@KalpeshSoni right-click -> Open file location -> right-click the shortcut. Properties is available there. – Jean-Bernard Pellerin – 2019-04-08T16:54:44.070

2

This how-to demonstrates how to easily change the default path in a command prompt.

Many people tend to run the command cd /d C:\ to do so. This is great but but running this command does not permanently change the path so you will have to change the path next time you open the Command Prompt.

Some people also edit the registry to achieve this but that is easier to mess up.

The last solution I've seen is to create a .bat that runs the command cd /d C:\ every time you open the Command Prompt. This causes an extra step and can cause confusion in the future.

The method in this How-to shows, in my opinion, the most direct and easiest way to change your default path.

2 Steps total

Step 1

Open the Command Prompt's Location

On the start screen / menu, type in "cmd", right-click it and select "Open File Location".

Step 2

Open the Command Prompt Properties and change the "Start In" Property Right-Click on "Command Prompt" icon, select "Properties", and edit the "Start In" property to your desired path. I used "C:\" as an example

When starting the command prompt, the default path will be the new path you've specified earlier

Fernando Coronado

Posted 2016-04-21T15:58:53.503

Reputation: 21

0

To add on to another comment above, if you are on Windows 10, you can accomplish this two ways. Open the start menu and type in cmd. Right click the Command Prompt app and select Open file location. Right click on the Command Prompt shortcut in the Explorer window that opens and select Properties, and change the Start in: field to C:\ or any location that you want Command Prompt to default to.

This same process can be repeated for PowerShell.

Note: If you have either Command Prompt or PowerShell pinned to your taskbar, hold shift and right click the icon and select Properties. You can change the same settings in that shortcut as well.

pantsme

Posted 2016-04-21T15:58:53.503

Reputation: 1