Ask Question Forum:
Model Library:2025-02-08:A.I. model is online auto reply
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by Knowledgeable
at 2024-07-22 19:53:08
Point:500 Replies:9 POST_ID:829076USER_ID:11978
Topic:
Windows 7;Microsoft Operating Systems;Microsoft Windows Operating Systems
I'm looking for a quick and easy way of exporting and importing Windows environment variables.
I have a user who creates a lot of custom Windows environment variables that do things such as launch custom Windows Explorer paths, open different programs, and do other things.
These variables are defined with letters such as u that has a value of C:Users so that when the user types in %u% within a Windows Explorer browser window or within the run dialog box Windows Explorer will open in the C:Users folder.
The user also has several programs that will launch if other variables such as %a% or %m% are typed in.
We would like to be able to export these custom Windows Explorer environment variables so that they can be exported into another Windows operating system.
How can this be done?
I have a user who creates a lot of custom Windows environment variables that do things such as launch custom Windows Explorer paths, open different programs, and do other things.
These variables are defined with letters such as u that has a value of C:Users so that when the user types in %u% within a Windows Explorer browser window or within the run dialog box Windows Explorer will open in the C:Users folder.
The user also has several programs that will launch if other variables such as %a% or %m% are typed in.
We would like to be able to export these custom Windows Explorer environment variables so that they can be exported into another Windows operating system.
How can this be done?
Accepted Solution
Expert: Adam Ray replied at 2024-07-28 01:20:33
84 points EXCELLENT
Once you export the registry key(s) as a .reg file--using one of the methods above--all you have to do is double-click the .reg file and it will import them in a couple clicks. (Be sure and remove all but your "custom" entries from the .reg file using a text editor before importing, or you will likely mess up the Windows defined variables that may vary from computer to computer.) This will be the easiest method to setup, and probably also the fastest (even with the additional clicks) if you were planning on running the script "manually" on each computer.
If you specifically want a script that can be run during logon, you can do it directly from a .bat file using the "reg add" command. (reference: http://technet.microsoft.com/en-us/library/cc742162.aspx.) -- This approach requires one "reg add" command for each environment var you want to add.
Alternative ways to script it: Use powershell (I've never done it this way, so I don't know the exact process.)
Use a third party utility like kixtart that can be used in a script to import a .reg file.
Note: You may come across mentions of importing a .reg file from the command line/script using the "regedit" command. If I remember correctly this method no longer works with the increased security in Win7/8, at least it doesn't work easily. The other script solutions I mentioned will likely need to be ran from an elevated command prompt.
If you specifically want a script that can be run during logon, you can do it directly from a .bat file using the "reg add" command. (reference: http://technet.microsoft.com/en-us/library/cc742162.aspx.) -- This approach requires one "reg add" command for each environment var you want to add.
Alternative ways to script it: Use powershell (I've never done it this way, so I don't know the exact process.)
Use a third party utility like kixtart that can be used in a script to import a .reg file.
Note: You may come across mentions of importing a .reg file from the command line/script using the "regedit" command. If I remember correctly this method no longer works with the increased security in Win7/8, at least it doesn't work easily. The other script solutions I mentioned will likely need to be ran from an elevated command prompt.
Author: Knowledgeable replied at 2024-07-25 06:03:39
I would like to be able to know how to do this import on several computers using some type of command line command or script that will add this info to the registry.
I don't want to have to manually type in all of these variables one by one.
I don't want to have to manually type in all of these variables one by one.
Expert: Adam Ray replied at 2024-07-23 11:06:32
Can you describe a bit more about your import scenario? Eg. About how many computers to import to, a one time import, if you need there to be a master list that (if it gets updated) it will automatically push out the new settings.
I ask because while there are several ways to do the process, there is always a tradeoff in how long it takes to setup vs how long it would take to do it with less automation.
I ask because while there are several ways to do the process, there is always a tradeoff in how long it takes to setup vs how long it would take to do it with less automation.
Expert: Mike T replied at 2024-07-23 07:45:40
Hi,
Yes, I tried set and dir env: and prefer the output as it adds a nice gap in PowerShell that's all. Both work but don't really address the import to the new machine.
Mike
Yes, I tried set and dir env: and prefer the output as it adds a nice gap in PowerShell that's all. Both work but don't really address the import to the new machine.
Mike
Assisted Solution
Expert: duncanb7 replied at 2024-07-23 06:00:49
83 points EXCELLENT
Win environment variables that is depended on how you define its definition.
Some third-party application variables being installed in the window that you can classify it as win variables so, regedit is useful
IF just window 7 variable system itself, set > env.txt
So, all insides and outside application or system variable stored in window ,we
call window variable, Right ?
Duncan
Some third-party application variables being installed in the window that you can classify it as win variables so, regedit is useful
IF just window 7 variable system itself, set > env.txt
So, all insides and outside application or system variable stored in window ,we
call window variable, Right ?
Duncan
Assisted Solution
Expert: duncanb7 replied at 2024-07-23 05:55:51
83 points EXCELLENT
if so, why not just "set" command at cmd.exe shell without powershell
set > env.txt
Duncan
set > env.txt
Duncan
Assisted Solution
Expert: Mike T replied at 2024-07-23 05:41:48
83 points EXCELLENT
Hi,
The registry keys will work, but just thought an easy way to export is with PowerShell.
dir env: >env.txt
This will save all the environment variables to a text file. If I knew more PowerShell I could suggest a way to import them, but I'm still learning it.
It has the advantage of producing a nice list you can print (or read).
Mike
The registry keys will work, but just thought an easy way to export is with PowerShell.
dir env: >env.txt
This will save all the environment variables to a text file. If I knew more PowerShell I could suggest a way to import them, but I'm still learning it.
It has the advantage of producing a nice list you can print (or read).
Mike
Assisted Solution
Expert: duncanb7 replied at 2024-07-22 23:45:23
83 points EXCELLENT
You can write batch script to save all registry key into file and import it on other computer, for example,
regedit /e "c:yourtargetkey.reg" HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment HKEY_CURRENT_USEREnvironment
Hope understand your question.If not, pls pt it out
Duncan
regedit /e "c:yourtargetkey.reg" HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment HKEY_CURRENT_USEREnvironment
Hope understand your question.If not, pls pt it out
Duncan
Assisted Solution
Expert: Adam Ray replied at 2024-07-22 22:02:51
84 points EXCELLENT
The environment variables are stored in two registry keys (system wide and user specific)
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment HKEY_CURRENT_USEREnvironment
Use a text editor to edit (and combine/if desired) the .reg file it exports. Keep only the "custom" entries you want to export/import. E.G. You do NOT want to import the windows created environment variables from another computer.
If double-clicking the .reg file on each computer to "manually" import is not sufficient, there are various ways to automate pushing the registry entries onto multiple computers. (But most of the methods are more work than they are worth if you're just doing a one-time import onto a handful of computers.)
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment HKEY_CURRENT_USEREnvironment
Use a text editor to edit (and combine/if desired) the .reg file it exports. Keep only the "custom" entries you want to export/import. E.G. You do NOT want to import the windows created environment variables from another computer.
If double-clicking the .reg file on each computer to "manually" import is not sufficient, there are various ways to automate pushing the registry entries onto multiple computers. (But most of the methods are more work than they are worth if you're just doing a one-time import onto a handful of computers.)