02-09-2012 10:37 AM - edited 02-09-2012 10:39 AM
Here is yet another simplification. Hopefully I have not changed the way it works.
02-09-2012 11:36 AM
It just occured to me that since a % sign is allowed to be used in an Environment Variable name, removing leading and trailing % signs (or not adding them if present) could cause errors. Windows does not complain if I use a leading and/or a trailing % sign in a name. It is best just to note on the front panel and in the documentation to enter the name wothout % signs. The only other solution is to try to recover the variable using various combinations and look for errors. Even this is questionable since there could be two like names, one with a % sign and one without.
02-10-2012 12:38 PM - edited 02-10-2012 12:46 PM
Here is some more info. There are three ways to do this: Use the System Exec.vi to go through the DOS shell (As shown above); Use the Registry VIs; Use a CLN with the kernal32 DLL. Mychal at NI sent me a VI using the CLN method. I reorganized it to my liking, and this is shown in the snippet. His uses a smaller icon without error terminals. I've added error terminals, even though they really are not needed since the DLL will always be there. Only mine is attached here because I accidently overwrote his in the Outlook Temp folder.
02-10-2012 12:56 PM - edited 02-10-2012 12:56 PM
My apologies if I have Mychal's gender wrong in the above post. I mentally transliterated Mychal to the English Michael.
09-02-2014 03:22 PM
Why make this so hard, just use .net method?
09-02-2014 04:36 PM
Cool! No one I spoke with at NI suggested this, and I wasn't familiar with .NET at the time.
09-02-2014 04:53 PM
Holy Cow. Yes. Kudo'ed
11-10-2014 06:53 PM
It's a convenient way, but could you explain the way to find this GetEnvironmentVariable object?
Thanks.
11-10-2014 07:17 PM
11-11-2014 07:23 AM
@guangdew1 wrote:
It's a convenient way, but could you explain the way to find this GetEnvironmentVariable object?
Thanks.
1) Invoke Node (.NET)
2) Right Click >> Select Class >> .NET >> Browse
3) Select mscorlib
4) Browse to System
5) Expand to select Environment
6) Select Method "[S]GetEnvironmentVariable(String variable)"
Info on this is found here:
http://msdn.microsoft.com/en-us/library/77zkk0b6(v=vs.110).aspx