command prompt

E

Elliott

How do I change the default location of the command
prompt. In a networked environment, when I go to a
command prompt, it defaults to my home network drive which
is G and I want to change this to something else. Help
would be greatly appreciated.

--XE
 
M

Mark V

In said:
How do I change the default location of the command
prompt. In a networked environment, when I go to a
command prompt, it defaults to my home network drive which
is G and I want to change this to something else. Help
would be greatly appreciated.

"Autorun" (registry)
See Tip 2373
http://www.jsiinc.com/
 
A

Austin M. Horst

Add Homepath \ to the User AND System Variables:

[Start]
Settings
Control Panel
System
Advanced tab
[Environment Variables...]
--------------
User Variables
[New]
Variable Name: Homepath
Variable Value: \
[OK]
----------------
System Variables
[New]
Variable Name: Homepath
Variable Value: \
[OK]


"Autorun" works, but is a BAD choice!
It causes that "autorun" command to run at the beginning
of all batch files. You may not want your script to
execute "c:" or "cd\".
If you use "autorun" you would need to use full path names
in all your batch scripts.

Austin M. Horst
 
M

Mark V

In said:
Add Homepath \ to the User AND System Variables:

[Start]
Settings
Control Panel
System
Advanced tab
[Environment Variables...]
--------------
User Variables
[New]
Variable Name: Homepath
Variable Value: \
[OK]
----------------
System Variables
[New]
Variable Name: Homepath
Variable Value: \
[OK]


"Autorun" works, but is a BAD choice!
It causes that "autorun" command to run at the beginning
of all batch files. You may not want your script to
execute "c:" or "cd\".
If you use "autorun" you would need to use full path names
in all your batch scripts.

Since HOMEPATH is a dynamicly created env. var. I do not suggest
manually over-riding it.

What is "BAD" about "Autorun"? Whatever command line or batch is
listed there is entirely separate from any user initiated batch file
and occurs before such a file is executed. Anyone writing a
batchfile would be foolish to assume anything about a drive or
directory being the default. The required locations should be
changed/confirmed within the user batch file to meet the needs of the
batch itself. And use of fully qualified paths (local and/or UNC)
within the user batch is basic methodology.
 
M

Mark V

In said:
How do I set it up to default to c:\ or c:\temp

Just enter the command(s) you would otherwise use
Examples:
CD /D D:\TEMP
CD /D C:\
CD /D C:\ & COLOR B0

Use HKCU instead of HKLM so this is localized to your profile.
 
G

Gary Smith

Mark V said:
Since HOMEPATH is a dynamicly created env. var. I do not suggest
manually over-riding it.

Why not? It obviously doesn't matter where HOMEPATH points so long as
it's a valid directory for the user. Manually setting the variable is the
method I expect to use when I eventually encounter the problem. (I
haven't yet installed SP4 or whatever patch causes it.)
 
M

Mark V

In said:
Why not? It obviously doesn't matter where HOMEPATH points so
long as it's a valid directory for the user. Manually setting the
variable is the method I expect to use when I eventually encounter
the problem. (I haven't yet installed SP4 or whatever patch
causes it.)

Because HOMEPATH (and HOMEDRIVE) is not a statically system-defined
or statically user-defined variable (in the two registry locations).
In fact, it may have been set by the network (domain) administrator
for a purpose. You can of course choose to set it (over ride it)
manually, but the Autorun valuename in the registry was designed to
do what is wanted. Namely, change the default drive/directory for
new instances of cmd.exe on a per system or per-user basis. IOW the
right tool/method for the job.

That's my take and you may of course do as you will.
 
G

Gary Smith

Mark V said:
In microsoft.public.win2000.cmdprompt.admin Gary Smith wrote:
Because HOMEPATH (and HOMEDRIVE) is not a statically system-defined
or statically user-defined variable (in the two registry locations).
In fact, it may have been set by the network (domain) administrator
for a purpose. You can of course choose to set it (over ride it)
manually, but the Autorun valuename in the registry was designed to
do what is wanted. Namely, change the default drive/directory for
new instances of cmd.exe on a per system or per-user basis. IOW the
right tool/method for the job.

Well, I'm the administrator here, so that's not an issue. Evidently
HOMEPATH is one of those variables that the system will define unless
there's a system or user variable by the same name. I haven't found where
the default comes from, but I know that one of the service packs or
patches changes that default. If you have shortcuts defined to open in
%HOMEDRIVE%%HOMEPATH%, such a change can be quite disruptive when the
program involved is not cmd.exe.
 
M

Mark V

In said:
Well, I'm the administrator here, so that's not an issue.
Evidently HOMEPATH is one of those variables that the system will
define unless there's a system or user variable by the same name.
I haven't found where the default comes from, but I know that one
of the service packs or patches changes that default. If you have
shortcuts defined to open in %HOMEDRIVE%%HOMEPATH%, such a change
can be quite disruptive when the program involved is not cmd.exe.

See advanced user accounts settings for Profile. For a local account
this defaults to "local path" (not specified) and then the HOMEDRIVE,
HOMEPATH are derived from the User's Profile location. In a domain
the account may use Roaming Profiles or the admin (you can do this
with local accounts too) may have set a "Home Folder" mapping and if
so then HOMEDRIVE, HOMEPATH and HOMESHARE are based on that. So this
is an environment variable but not a conventionally set one and not
normally stored as with PATH for example. It is account-specific but
"dynamically" (for want of a better word) created from account
profile information. Hope that's interesting. You may not find
mapping a "Home Folder" to be much to your liking though. <G>

You will find that setting a User environment variable will replace
the value dynamically set by the system from the account information,
as it is applied later in the logon process.

I sure agree about HOMEDRIVE\HOMEPATH in shortcuts though! If you
have a lot of those you might replace the strings in batch using a
shortcut command-line utility perhaps. Or just set those User vars
as you like although I cannot guaranty that that will not possibly
cause a problem in something sometime... YMMV :)

So, "Autorun" for cmd.exe does what the OP needed and recommend that
method for that purpose.
 

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