Sign in to follow this  
Followers 0
mist3r

Is it within the registry?

13 posts in this topic

Hey,

I'm wanting to make a sweet and simple script that will message box a variable set within Windows. I've looked at the Env functions but I think im getting confused between variables I define within the program and windows variables.

So if I defined "LOCATION" as "UPSTAIRS" in windows, then by running a script it will simply msgbox "UPSTAIRS".

I think its in the registry and what command would i need to read it? I've been trying all sorts but with no joy :wacko:

Thanks for your help,

very much appreciated :D

phil

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Exactly where are you setting these variables?

With that i mean: Where do you define "UPSTAIRS"

If you mean in the source code of your program, this would be it:

$location = "upstairs"
msgbox (0,"Sweet script", $location)
Edited by raedts

Share this post


Link to post
Share on other sites

Ok cool, sort of heh...

thanks but I goto rightclick my computer... properties to bring up the system information. Click advanced > environmental variables and set it within that.

It's just for a printer logon script that I need to set it in there. Thing is, im trying to make a quick nasty program that will check to see if the machines settings are correct.

It will basically check to see if a folder exists to determine whether or not its been installed. So within my work, we have to install loads n loads of software and set certain things including the location. This program will basically check things and then pop up if its not set or atleast indicat what its been set to.

Thanks raedts for ya help, prehaps you know how to read those variables ? :D

Share this post


Link to post
Share on other sites

Ahh the nework settings, i will try to look them up...

It's late/early here(1 am in the morning). so if i don't find them quickly you may have to wait some time because i need to sleep :D

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

FOUND!

Its stored in the registry:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment

How to read it?

uhh zzzz. srry uhm i need sleep...

This pc doesn't have AutoIt installed, maybe you could look yourself in the Help Files of autoit, i think its like Regread or something...

I will reply tomorrow :D.

Maybe some other forum member could help you out with reading it....

Cya!

Edited by raedts

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

If the variable is set in the area labeled:

User variables for LocalControl

it will be written to

HKEY_CURRENT_USER\Environment

Just set some variable and serach the registry for it...

Edit:

If the variable is set in the area labeled:

System variables

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment

Edit2:

From Mastering Windows XP Registry

by Peter Hipson

There are also other aliases in the registry. For example, the registry key

HKEY_LOCAL_MACHINE\_System\CurrentControlSet is an alias to one of the other

control setsControlSet001, ControlSet002, or sometimes ControlSet003. Again, this is that

same magic; only one registry object is there, it just has two names. Remember, in modifying

a specific registry key or subkey; don't be surprised when another registry key or subkey

seems to magically change also!

556 pages of stuff I don't understand... Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Awesome!! No thats very helpful you guys. Its about 12:12AM here so im gonna go to sleep n all. I'll crack on with it tommoz morning, thanks for being soo speedy.

Cheers!

Share this post


Link to post
Share on other sites

Sigh.... coudnlt help it :D

I am addicted to AutoIt

code:

$test = RegRead ( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "LOCATION" )
MsgBox (0,"test", $test)

This is for System Variables.

You could change "LOCATION" into what ever you want...

Share this post


Link to post
Share on other sites

Aaah aarh!!

$location = RegRead( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "LOCATION" )

msgbox (0,"Sweet script", $location)

Wooah my first script that worked lol :D

Cheers again! Now im going to attempt a few IF's..

so if its blank then give me the option to set it prehaps. Heh, i'll be posting again very very soon.

Share this post


Link to post
Share on other sites

Edit2:

I know raedts had that info from my edit...

:D no i didn't :S i just created a varable: Lokaal113 and searched the registry :wacko:

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

:D no i didn't :S i just created a varable: Lokaal113 and searched the registry :wacko:

I was attempting to explain these 3 things:

That I had seen your post.

My first edit duplicated some of your info.

There seemed to be little reason for me to make that first edit...

...but I was building toward putting all 3 bits of info into one post.

I did not mean to imply that you got any info from me - it was just very poorly worded.

Perhaps this would have been better:

I know that raedts beat me to the info shown in my first edit...

edit: added more words.... :-)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Ahh sorry i judged to quick ^^

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Ahh sorry i judged to quick ^^

No problem...

If I could only type faster

http://www.autoitscript.com/forum/index.ph...st&p=202804

...I would have beat you to the post. :-) :-)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
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
Sign in to follow this  
Followers 0