Sign in to follow this  
Followers 0
jwc

Retrieve "Self Set" Environment Variable

11 posts in this topic

The end result is I want to set an environment variable outside of the script using the set command to a particular network path. ex. set netpath=\\servername\share.

Next I want to create an autoit script to open an explorer window to this path.

The problem I'm having is when I set the environment variable, AutoIt doesn't read the contents that I set. I can read existing env variables but not the ones I set.

I'm an amateur at this, more of a hacker at programs than a programmer so any help would be greatly appreciated.

Thanks.

Share this post


Link to post
Share on other sites



Hi,

why using Env if you only want to get a share to another PC?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

I'm in a multi-user environment, I will be setting environment variables when user logs on. Different users will access different shares according to the variables that are set when loggin on.

Share this post


Link to post
Share on other sites

I'm familar with the EnvGet command and this works fine and retrieves normal environment variables, however, variables that I set from a command prompt using the set command appear to be unretrievable using the EnvGet command. Ex. If I run "set junk=stuff" from a command prompt, when I run EnvGet command to retrieve "junk" there appears to be no data. If I run "set junk" from the command prompt, the data is there. ??? If I use the set command to create a variable in a command prompt, is it a global environment variable that can be retrieved by AutoIt?

Share this post


Link to post
Share on other sites

I'm familar with the EnvGet command and this works fine and retrieves normal environment variables, however, variables that I set from a command prompt using the set command appear to be unretrievable using the EnvGet command. Ex. If I run "set junk=stuff" from a command prompt, when I run EnvGet command to retrieve "junk" there appears to be no data. If I run "set junk" from the command prompt, the data is there. ??? If I use the set command to create a variable in a command prompt, is it a global environment variable that can be retrieved by AutoIt?

Use stdOutRead.

strOutRead read will get the output of a process ID and then save that to a variable.

Look for it in the index of the help, has a pretty good example

Share this post


Link to post
Share on other sites

Use stdOutRead.

strOutRead read will get the output of a process ID and then save that to a variable.

Look for it in the index of the help, has a pretty good example

this thread is 2 months old...

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

Environment variables only exist in the present environment. Once the process that made changes to the variable ends, the mini environment closes. This is why you cannot share environment variables in this way.

Share this post


Link to post
Share on other sites

this thread is 2 months old...

And your point?

Share this post


Link to post
Share on other sites

And your point?

I hope you realize you just insulted a post from 6 years ago. And the post you insulted was pointing out someone necroing the thread, good going!!!

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Well it was his own post that got the comment, and even though it is only 6 years ago, one has to respond when somebody asks a question.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0