TransWikia.com

How do you create system variables via batch file for Windows 7?

Super User Asked by Ali Ullah on November 20, 2021

How can I create a batch file which creates a new system variable?

(You know, in advanced system settings > environment variables > System Variables).

I want to create a new variable named FLEXLM_TIMEOUT and set its value to 10000000.

I need to figure out a way to create this variable in an automated fashion as I have around one hundred computers that need this fix.

2 Answers

Probably the easiest way to do this is to create a .REG file for the path HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment

The script should be:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment] "FLEXLM_TIMEOUT"="10000000"

You don't even need to write the script from scratch: on a PC that has the variable, in Regedit, highlight the key Environment and in the File menu select Export.... The .REG file created will contain other values than FLEXLM_TIMEOUT, which need to be deleted by editing the file in Notepad.

Merging that file in will not delete the existing values; REGEDIT performs a true merge.

Answered by DrMoishe Pippik on November 20, 2021

You are looking for the SetX command:

 setx FLEXLM_TIMEOUT "10000000" /m

Should do what you are wanting.

This command has been standard in Windows since Vista and XP had it available in the XP Support Tools. It also has the ability to set variables on remote machines if needed.

Answered by krowe on November 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP