Cmd.exe won't inherit directory

B

Brian Hartin

Hi there,

On my PC, cmd.exe will not inherit the current directory. This is
seen from the command line, as well as when processes are launched
from scripts, etc.

I can reproduce this in a command window as follows:

(Start a command window)

C:\Documents and Settings\hartbr>cd \

C:\>c:\windows\system32\cmd.exe
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\hartbr>

It should have started the new cmd.exe process in C:\. I've checked
this on several other computers and mine is the only one with this
problem.

Does anyone know what might cause this? I've been searching all day
with no luck.

Thanks!

Brian
 
J

John John - MVP

Brian said:
Hi there,

On my PC, cmd.exe will not inherit the current directory. This is
seen from the command line, as well as when processes are launched
from scripts, etc.

I can reproduce this in a command window as follows:

(Start a command window)

C:\Documents and Settings\hartbr>cd \

C:\>c:\windows\system32\cmd.exe
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\hartbr>

It should have started the new cmd.exe process in C:\. I've checked
this on several other computers and mine is the only one with this
problem.

Does anyone know what might cause this? I've been searching all day
with no luck.

Maybe take a look at the AutoRun value at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

The above is system wide, the same setting can also be per user, take a
look at the same key in the HKCU subtree.

John
 
B

Brian Hartin

Maybe take a look at the AutoRun value at
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

John,

That was it! Thank you so much. Do you know how this value typically
gets set?

Thanks again,

Brian
 
J

John John - MVP

Brian said:
John,

That was it! Thank you so much.

You're welcome.

Do you know how this value typically
gets set?

Typically by a user or administrator. By default the this (AutoRun)
value is not present in the HKCU branch and is blank in the HKLM branch
and the command prompt always starts in the %userprofile% directory.
Installing certain utilities might have changed or added the value.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top