Jump to content

System Variables


Recommended Posts

Does anyone know if there is a way to set a systemwide variable using autoit ? i know you can get the variables by useing envget but how can you set it so other programs outside of autoit can use that variable. ???

any help is appreciated.

cheers

Link to comment
Share on other sites

hmm would love too. but the idea is to check what type of machine is running, so that at a later date i can just pull that info out of a system variable

ie we have tecra 8100 - 9100 - m1 - m2 and m3 notebooks, each require a different setting for the power save utils. so i need to call that variable to choose what registry settings the machine will get to turn off hibernate and standby modes etc...

Link to comment
Share on other sites

Does anyone know if there is a way to set a systemwide variable using autoit ? i know you can get the variables by useing envget but how can you set it so other programs outside of autoit can use that variable. ???

any help is appreciated.

cheers

<{POST_SNAPBACK}>

Write to the Registry. Try this:

RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "XXX111YYY222ZZZ", "REG_SZ", "THIS WRITES A SYSTEM VARIABLE")

Phillip

Link to comment
Share on other sites

Does anyone know if there is a way to set a systemwide variable using autoit ? i know you can get the variables by useing envget but how can you set it so other programs outside of autoit can use that variable. ???

any help is appreciated.

cheers

<{POST_SNAPBACK}>

I haven't played with this enough to know when they become available, but to permanently, but you can write environment variables directly to the registry.

To set a USER environment variables, use:

RegWrite ( "HKEY_CURRENT_USER\Environment", "VariableName", "REG_SZ", "VariableValue" )

To set a System (global) variable, use:

RegWrite ( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "VariableName", "REG_SZ", "VariableValue" )

Being a command line junkie, any system I use regularly has:

RegWrite ( "HKEY_CURRENT_USER\Environment", "Desktop", "REG_EXPAND_SZ", "%USERPROFILE%\Desktop" )
RegWrite ( "HKEY_CURRENT_USER\Environment", "MyDocs", "REG_EXPAND_SZ", "%USERPROFILE%\My Documents" )

so that from a command prompt I can type

CD %desktop%

to change to my Desktop directory, and likewise to My Documents.
Link to comment
Share on other sites

Try using EnvUpdate ( )

Similar effect as logging off and then on again

I used it on my BartPe to set TARGET_ROOT so I can used the tools for ERD commander.

EnvSet("TARGET_ROOT", "C:\Windows")

EnvUpdate()

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...