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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variables 1

Status
Not open for further replies.

lvf

Technical User
Sep 16, 2002
10
0
0
NL
Hi,

Is het possible to use variables in the shell command.

I'm trying to load a reg-file with
shell "regedit /s c:\user-pc.reg"

Where user must be the username.

Any help is welcome
 
You simply use the variable for the username like this:

UserName = "John Doe"
shell "regedit /s c:\" & UserName & "-pc.reg"

 
Yes you can use variables. You will nedd to use string concatenation to place them into the string that you want to use. For example, "String" & variable & "String"

However I don't understand what you are trying to do. The regedit command will open the registry and not a reg file. Files ending in .reg can be opened in notepad. Can you calrify what it is you are trying to do?

Thanks and Good Luck!

zemp
 
Thanks guys,

Username = Environ("USERNAME")
shell "regedit /s c:\" & UserName & "-pc.reg" works for me.

Ik try to load multiple registry keys into the HKU for different users when they logon.

Greetzz,
LVF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top