Environment variables and paths

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello. I am trying to have a path set for users during the login script. I
need to set a drive that does the same thing as the novell search drive.
Please help.
 
Kevin said:
Hello. I am trying to have a path set for users during the login script. I
need to set a drive that does the same thing as the novell search drive.
Please help.

Insert this line in your logon script to include e:\YourTools in the path:

@echo off
path %path%;e:\YourTools
 
Ok, I see it doing it in the login script but when I goto a dos prompt and
type in path, it is not there. How do I get it to append to my existing path
and save it?
 
In your original post you said that you wanted to set the path
during the logon script. This is exactly what the "set" command does:
It sets an environmental variable while the logon script runs. When
that process finishes, the settings are lost.

If you want the settings to persist then you must use setx.exe.
It comes with the Win2000 Resource Kit. Any variable set by
setx will be available to all processes that are launched ***after***
the execution of setx.
 
Sorry about the misinformation. So using the setx, what is the correct entry
into my login script now? I tried putting the setx into the script and it
says it is not a recognized command.
 
As I said, setx.exe comes with the Win2000 Resource Kit.
You must purchase the kit, install it, then refer to setx with
a fully qualified address, eg.
"c:\program files\Windows 2000 Resource Kit\setx.exe".
To see the proper syntax, type
"c:\program files\Windows 2000 Resource Kit\setx.exe" /?
 
I have the resource kit and it is installed.
So using the setx, what is the correct entry into my login script now? I
tried putting the setx into the script and it says it is not a recognized
command.
 
You write that your logon script looks like so:
@echo off
path %path%;l:\apps\wangbat

You also wrote "I tried putting the setx into the script and it says
it is not a recognized command." I put on my magnifying glasses
but no matter how hard I try, I cannot see the setx command.
Where is it?
 
Your syntax is at variance with the example given by setx /?:

Command Line Mode: setx variable value [-m]
Optional Switches:
-m Set value in the Machine environment. Default is User.

a) You inserted an "=" where no "=" can exist.
b) You omitted the "-m" switch.
 
ok I used the m switch before the path and I get the command is not
recognized and I tried it after the path and get the same thing. Can you
just give me the correct syntax for my entry in the login script so we don't
have to keep going back and forth?

Pegasus (MVP) said:
Your syntax is at variance with the example given by setx /?:

Command Line Mode: setx variable value [-m]
Optional Switches:
-m Set value in the Machine environment. Default is User.

a) You inserted an "=" where no "=" can exist.
b) You omitted the "-m" switch.


Kevin said:
@echo off
setx=path %path%;l:\apps\wangbat
 
setx.exe is an executable file, same as notepad.exe
or calc.exe. The syntax

notepad=abc

makes absolutely no sense, same as

setx=abc

makes no sense. There MUST be at least one
space (or some other suitable delimiter) between
the name of the executable and any parameters.
"=" is not a suitable delimiter.

The inbuilt help facility suggests this syntax:

setx variable value [-m]

Expanding this suggestion, one gets

"c:\program files\trk\setx.exe path %path%;c:\tools -m

If you are responsible for the maintenance of logon scripts,
and probably for server administration, then you might want
to familiarise yourself with the command line environment
and how to use executables and their parameters.


Kevin said:
ok I used the m switch before the path and I get the command is not
recognized and I tried it after the path and get the same thing. Can you
just give me the correct syntax for my entry in the login script so we don't
have to keep going back and forth?

Pegasus (MVP) said:
Your syntax is at variance with the example given by setx /?:

Command Line Mode: setx variable value [-m]
Optional Switches:
-m Set value in the Machine environment. Default is User.

a) You inserted an "=" where no "=" can exist.
b) You omitted the "-m" switch.


Kevin said:
@echo off
setx=path %path%;l:\apps\wangbat

:

@echo off
path %path%;l:\apps\wangbat

:

Please quote the exact line from your logon script.


I have the resource kit and it is installed.
So using the setx, what is the correct entry into my login
script
now? I
tried putting the setx into the script and it says it is not a recognized
command.

:

As I said, setx.exe comes with the Win2000 Resource Kit.
You must purchase the kit, install it, then refer to setx with
a fully qualified address, eg.
"c:\program files\Windows 2000 Resource Kit\setx.exe".
To see the proper syntax, type
"c:\program files\Windows 2000 Resource Kit\setx.exe" /?


Sorry about the misinformation. So using the setx, what is the
correct
entry
into my login script now? I tried putting the setx into the script
and it
says it is not a recognized command.

:

In your original post you said that you wanted to set the path
during the logon script. This is exactly what the "set" command
does:
It sets an environmental variable while the logon script
runs.
When
that process finishes, the settings are lost.

If you want the settings to persist then you must use setx.exe.
It comes with the Win2000 Resource Kit. Any variable set by
setx will be available to all processes that are launched
***after***
the execution of setx.


Ok, I see it doing it in the login script but when I
goto a
dos
prompt
and
type in path, it is not there. How do I get it to
append to
my
existing
path
and save it?

:


Hello. I am trying to have a path set for users
during
the
login
script.
I
need to set a drive that does the same thing as the novell
search
drive.
Please help.

Insert this line in your logon script to include e:\YourTools in
the
path:

@echo off
path %path%;e:\YourTools
 

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

Back
Top