3

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.

  • Corporate IT issues are off topic. – CharlieRB Mar 10 '15 at 19:57
  • @CharlieRB This is a question about usage of Windows which is on-topic. – Kevin Panko Mar 11 '15 at 18:48
  • @KevinPanko Sorry. I see it differently. The help center specifically states "issues specific to corporate IT support and networks" are off topic. If the question didn't state "I have around 100 computers that need this fix", I'd probably agree with you. – CharlieRB Mar 11 '15 at 20:20
9

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.

0

Probably the easiest way to do this is to create a .REG file for the path HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

The script should be:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] "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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.