Re: set user=%username%



Your most recent feedback confirms that Windows is
working exactly as it should. The variable %user% is
set as expected.

However . . . it seems that you are trying to do something
entirely different, without actually saying so. I suspect
that you wish to set the %user% variable during the logon
process, and then expect to see it in other processes that
are launched subsequently.

This is not the way environmental variables work. Each
child process "inherits" a copy of the parent environmental
variables. The child process can do whatever it likes with
these variables, because they are strictly local. The do NOT
get passed to other processes! I encourage you to try this
little test:
1. Start a Command Prompt.
2. Type this: set MyName=Roland
3. Type this: echo %MyName%
4. Type this: cmd
5. Type this: echo %MyName%
6. Type this: set YourName=Pegasus
7. Type this: echo %YourName%
8. Type this: exit
9. Type this: echo %YourName%

If you wish to set a variable during the logon process
and make it available to other processes then you must
use setx.exe from the Windows Resource Kit. Note that
any such variable will be inherited by processes launched
later on but NOT by pre-existing processes.


"roland" <roland@xxxxxxxxxxx> wrote in message
news:OMKNbkicFHA.1356@xxxxxxxxxxxxxxxxxxxxxxx
> Pegasus you do understand that i am trying to set a variable "user" to be
> the same as what ever %username% in this case my logon name "rolandp"
>
> I am trying to get this done with a script i have on my domain control
> sysvol folder.
>
> I also have the group policy setting under user configureration enabled
for
> the login in script
>
> Hope what i said makes sense
>
> Roland
>
> user=RolandP
> user1=RolandP
> USERDNSDOMAIN=gladneycenter.org
> USERDOMAIN=GLADNEYNT
> USERNAME=RolandP
> USERPROFILE=C:\Documents and Settings\rolandp
> usertest=This is a long string. This is a long string. This is a long
>
>
> "Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
> news:uFxYcOicFHA.3464@xxxxxxxxxxxxxxxxxxxxxxx
> > Your feedback tells me a couple of things:
> > - You're running cmd.exe as a command processor, not
> > command.com. That's the way it should be.
> > - The system variable %UserName% is set, as it should be.
> >
> > Now let's try a little batch file:
> > @echo off
> > set user=%UserName%
> > set user1=%UserName%
> > set usertest=This is a long string. This is a long string. This is a
long
> > string.
> > set user > c:\test.txt
> >
> > Run this batch file, then paste the contents of c:\test.txt
> > into your reply.
> >
> >
> > "roland" <roland@xxxxxxxxxxx> wrote in message
> > news:eXyLNJicFHA.2076@xxxxxxxxxxxxxxxxxxxxxxx
> >> As you can see my user variable doesn't get set.
> >>
> >> any ideas ?
> >>
> >> Roland
> >>
> >>
> >> C:\>set user
> >> USERDNSDOMAIN=gladneycenter.org
> >> USERDOMAIN=GLADNEYNT
> >> USERNAME=rolandp
> >> USERPROFILE=C:\Documents and Settings\rolandp
> >>
> >> C:\>set | find/i "comspec"
> >> ComSpec=C:\WINDOWS\system32\cmd.exe
> >>
> >> C:\>
> >>
> >>
> >>
> >> "Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
> >> news:uFH8jqhcFHA.2980@xxxxxxxxxxxxxxxxxxxxxxx
> >> >
> >> > "roland" <roland@xxxxxxxxxxx> wrote in message
> >> > news:uAzaNBfcFHA.2960@xxxxxxxxxxxxxxxxxxxxxxx
> >> >> I have a batch file in my sysvol and a group policy object for it.
> >> >>
> >> >> Is this a valid command "set user=%username%" ?
> >> >>
> >> >> when I run the set cmd at the dos prompt I don't get the user
variable
> > in
> >> >> the list.
> >> >>
> >> >> Windows xp pro workstations, Windows 2003 servers and domain
> >> >> Moved all my data from my Novell servers to Microsoft over the
weekend
> >> >>
> >> >> All need to complete this and get rid of the Novel is to be able to
> >> >> set
> >> > that
> >> >> one variable.
> >> >>
> >> >> Thanks Roland
> >> >>
> >> >>
> >> >
> >> > What do you get when you type thes commandd at the Command Prompt?
> >> >
> >> > set user
> >> > set | find /i "comspec"
> >> >
> >> >
> >>
> >>
> >
> >
>
>


.



Relevant Pages

  • Re: Adding to the front of a line
    ... to send it to my Windows using friends and family. ... echo "127.0.0.1 $site " ... I'm off to the string handling section of my favorite bash scripting ... Later, Ray Parrish ...
    (Ubuntu)
  • Re: Adding to the front of a line
    ... to send it to my Windows using friends and family. ... echo "127.0.0.1 $site " ... I'm off to the string handling section of my favorite bash scripting ... http://www.rayslinks.com/ Web index of human reviewed links. ...
    (Ubuntu)
  • Re: why use the sealed ?
    ... system that supports inheritance and polymorphism is to promote reusability. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... >> exceeds past the end of the string. ... >> application to be a Remoting Client. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: XP and string paths
    ... > the "Lcase" function is suddenly no longer available to Excel? ... > that occurs because of Windows XP. ... > string functions that Excel uses has become ... > is the usual "missing reference" problem. ...
    (microsoft.public.excel.programming)
  • Re: Internet connection on Linux
    ... If you are having to use windows to access Usenet: ... If you do not want some malware writing to linux. ... If using linux for Usenet access, su - root, copy script text into xx ... echo "You need to be root to run $0" ...
    (comp.os.linux.networking)