I expect the following code to open an explorer window to the system drive.
shell("%SYSTEMDRIVE%")
ts
ID:156847
![]() Jul 14 2010, 7:11 am
|
|
I can't seem to get any environment variables to work. I may be missing something.
I expect the following code to open an explorer window to the system drive.
shell("%SYSTEMDRIVE%")
ts |
I got it working with some help from a note left in the reference documentation for shell(). I was able to force the console window to stay open and see where I was going wrong. Thanks to whoever put that in there.
I just needed some additional double quotes.
shell("\"\"%PROGRAMFILES%\\MyApplication\\MyApp.exe\"\"")
ts |
I have to take that back. That only works if you pass in cmd /C. I'm still working on the proper syntax which doesn't require running cmd first.
shell("cmd /C \"\"%PROGRAMFILES%\\MyApplication\\MyApp.exe\"\"")
My expectation is that the following example should work bit it doesn't so I assume that I am missing needed double quotes. I'm also trying to pass in an argument as well. shell("\"\"%PROGRAMFILES%\\MyApplication\\MyApp.exe [myArg]\"\"") ts |
This should work...
shell("\"\"%PROGRAMFILES%\\MyApplication\\MyApp.exe\" [myArg]\"") Because this works... shell("cmd /C \"\"%PROGRAMFILES%\\MyApplication\\MyApp.exe\" [myArg]\"") but it doesn't... and I'm stuck... ts |
This is the best that I can do for now but it still shows the console window every time I execute it (which I don't want).
I can't figure out the syntax without using cmd /C. shell("cmd /C \"\"%PROGRAMFILES%\\MyApplication\\MyApp.exe\" [myArg]\"") I've made a wonderful mess of this post but if you are capable and have made it this far, I could still use a hand solving this. Thanks, ts |
I believe shell is set to call files directly... and since you want to use an environmental variable, it must go through the command prompt.
|
ts