Environment Variables


  1. Posts : 4
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #1

    Environment Variables


    Hi
    I set up a User defined Enviro. Var. called GomFolder to be C:\Users|Damo\MyDocuments\NinjaTrader 7
    See the attached clip
    2015-01-23_1242 - Judge101010's library

    My understanding is that this should set up a folder called GomFolder in the NinjaTrader 7 folder.
    Is this correct?

    If not; should I set up a folder in NinjaTrader 7 called GomFolder and then go into the Environment Variables and set up a new GomFolder Enviro. Var. as C:\Users|Damo\MyDocuments\NinjaTrader 7\GomFolder?

    Sorry if the question is remedial - I've done the first and can't find the GomFOlder anywhere after hours of looking so now i'm thinking my understanding is completely inaccurate and the Enviro. Var. settings only allow you to assign a name to something like in my case a filepath??

    Any help would be most appreciated
    Thanks
    Damo
      My Computer


  2. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #2

    Dear Damo,

    Everything you know about Environment Variables, please, erase from memory now.

    Okay. Now, let me re-word your OP:
    rosphite1 said:
    What are Environment Variables?
    I'm glad you asked, Damo, because I was just about to explain what they are.


    Environment Variables are essentially variables that store information about an Operating Environment, such as the computer name, the systems root directory, your username, temporary folders etc. These environment variables consist of key|value pairs, where both key and value entries are arbitrary strings. Many operation systems have their different implementations of them and set and use them differently. In Windows, environment variables are created by the OS at boot, and more so are created and some changes as the user progresses into their logged in session.

    A common environment variable that is native to Windows and Unix systems, is the Path variable. This variable holds a list of folder hierarchies, separated by a semicolon, that a shell would use to search for a command.

    Applications make use of these environment variables too. They can create their own temporary environment variables that exist until the application's process exits, and some applications rarely create persistent environment variables (which is what you've managed to do manually, Damo) that are a more permanent way of storing an environment variable i.e. writing the variable to the master environment: the registry.

    Environment variables are a way of passing configuration information from process to process (a process is just an instance of an executable). Each process has an Environment; an area in memory to store these environment variables. When a process starts a process (this new process is know as a child-process), the child-process inherits a copy of it's parent process' environment. A good example of this in action is How To Play Minecraft Off Your USB Drive.

    The Minecraft application queries the AppData environment variable in order to locate the user's AppData folder. That's how it knows where to save its game data. So by taking advantage of both the fact that the application uses this environment variable, and the fact that child-processes inherit environments; the tutorial in the Minecraft forums link above directs the user to create a Windows batch file which will change the AppData environment variable before launching the Minecraft executable. This new Minecraft process is a child-process of an instance of cmd.exe which is the command processor for batch files.


    A standard user should never need to concern themselves with environment variables in any way.
    rosphite1 said:
    If not; should I set up a folder in NinjaTrader 7 called GomFolder and then go into the Environment Variables and set up a new GomFolder Enviro. Var. as C:\Users|Damo\MyDocuments\NinjaTrader 7\GomFolder?
    I haven't the slightest clue what you are trying to do, Damo, but I would refrain from setting up a persistent environment variable that isn't going to do a thing.
      My Computer


  3. Posts : 4
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #3

    Thank you Pyprohly
    That's a lot of information - I appreciate you taking the time to go into the detail. I've read it a few times and I think I know what to do.

    To answer your question: I have an application running on the PC. My understanding is that the app will write data files to a folder called GomFolder, at the end of each day.

    If my understanding is correct from your post I need to create a new folder somewhere called GomFolder. Then I create an Enviro. Var. called GomFolder and set it's value to the path of where I put GomFolder. Then the app (NinjaTrader) will put the data files in GomFolder?

    Would that be along the right lines......?
      My Computer


  4. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #4

    rosphite1 said:
    My understanding is that the app will write data files to a folder called GomFolder, at the end of each day.
    My Google-ing of this "NinjaTrader" application tells me similar. I think you meant to say, though, "the app will write its data files to the value of the GomFolder environment variable". As "GomFolder" will simply be the variable name, that in this case will hold a path.

    So if the NinjaTrader application detects an environment variable named "GomFolder" (doubt the caps really matter), it will read the value of this "GomFolder" variable and write to the path location of the value that the variable represents; instead of it's default location (being "C:\username\Documents"?).

    It's my guess. But I'm pretty sure this is the nature of the application.

    Once you've created the environment variable, fire up NinjaTrader. There should not be a need to manually create the same path of the value you've decided to set "GomFolder" to. The application should create that for you.


    To create an environment variable, go to:
    Control Panel > System and Security > System > Advanced system settings > Environment Variables
    OR
    WinKey+Pause|Break > Advanced system settings > Environment Variables

    It does not matter if you create the environment variable in "User variables" or "System variables", but note that if you decide to create a variable in "System variables", other users on the local machine will be able to see and use this variable. On the other hand, variables in "User variables" are private and only accessible to that user account.


    An extra thing I ought to mention: to expand an environment variable you'd simply surround percent signs around the variable name. Type "%userprofile%" into the Windows Explorer bar, and notice it takes you to your user's home directory, because "userprofile", as you'll see, is an environment variable that expands to the path of your user directory. And once, Damo, you've set up "GomFolder" to be some path, type the variable name, surrounded by percents, into the Explorer bar. And watch as it takes you to the location of the value you've set the variable to.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:24.
Find Us