Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET NAME=XXXXX in XP

Status
Not open for further replies.

flamingferrari

Technical User
Jun 7, 2002
18
GB
We have some lagacy apps that need the variable

set name=JBloggs

to be set in the batch file.

We are currently trying to roll out Windows XP on the desktop.

Basically where to we put this variable?

Tried to put it in a batch file in the startup directory of the individual user and ALL USERS i.e.

setname.bat with the line

set name=jbloggs

When I use SET to view, the setting dont seem to change.

Thanks for your time & effort guys.
 
right-click My Computer, Advanced, at the bottom click Environmental Variables, and create the variable under the user section.
 
Thats great. I really appreciate the help.

This little tip means that my organisation can spend even less on IT by not updating its apps.

It will probably not be enough to justify and proper salary and baring that some training is it?

Hey, Im not complaining Ive got a job :) (wheres the career)







 
That is good advice but what if someone else logs in? Don't you need to reference some other variable? What I mean is, in the example before, is JBloggs the user name?
Then the name variable should reference %username%, correct?
Otherwise whatever "name" you hard code into this will always be there. I am assuming this variable is used to give access inside the program, correct?

Your batch idea is a good one, but I would have it run when they log in. Have it on a network share so that you can change one file and everyone will get the same change. Or just have it part of the login script. We set alot of variables in ours.

Jon

There is much pleasure to be gained from useless knowledge. (Bertrand Russell)
 
jontmke,

Variable expansion is available under the local as well as system wide enviornmental variables. You do not need to use a logon script for the expansion.

In particular, the local variables are local as they are processed post logon.

I do not understand your criticism of my approach.
 
I just meant that if he puts "jblogg" as the value of the variable it is permanent. Maybe that is what he wants, but I thought he was referring to the person who is logging on, and needed to input the user name into that variable.

Jon

There is much pleasure to be gained from useless knowledge. (Bertrand Russell)
 
Jontmke,

Your criticism still eludes me.

If I have two users on a machine, bcastner and jontmke, and I set a local environmental variable: name=bcastner under my profile; and name-jontmke under your profile; when I logon as bcastner the name variable is correct, and when you logon the name variable is correct.

Similarly, if in creating a default user profile, I set a macro expansion for a local variable of name=%username%, or do so in each individual already created profile, the expansion works and the environmental variable name is appropriately assigned on logon.

You post above suggests this is only possible through the logon script and criticise my solution.

I just do not understand the criticism.
 
The more I think about this the less happy I am. If it was not for the fact that there was logon macro expansion then there would not be a valid pointer to c:\documents and settings\%username%\ under Windows.

You do not have this in your logon script because of the fact that local environmental variables are expanded with reserved macro variables during logon and are accesible as a result to the default path assignments. And you have access in scripting to these native variables.

As do the local environmental variables if they need a specificly named variable assignment.

I just do not understand your point. Any notion that the local environment can only be set through a logon script just simply confounds me as a claim.

Please show some supporting evidence for your claim.



 
Sorry if I got you riled up, that was not my intention. I was only trying to get into more detail on how to automate this. Which you explained well in your later response:

Similarly, if in creating a default user profile, I set a macro expansion for a local variable of name=%username%, or do so in each individual already created profile, the expansion works and the environmental variable name is appropriately assigned on logon.

This is what I was trying to get at in my response. The idea of having it get this new variable from an existing one and inputing that when the user logs on.

In no way was it intended as a criticism of your advice. Only an attempt to further explain what was needed. Which you did better than I did.

Jon

There is much pleasure to be gained from useless knowledge. (Bertrand Russell)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top