#1
|
|||
|
|||
Environment Variable
I have SecureCRT Version 6.7.3(build 292).
I have several sessions set up with a login script using an Environment variable and Session name: HTML Code:
%VanDyke%%S.vbs HTML Code:
C:\Users\eheamay\AppData\Local\VanDyke Software\SecureCRT\Scripts\ This has worked on earlier versions, so I wasn't sure if something has changed in this new version? Thanks for your time. ![]() |
#2
|
|||
|
|||
Hi he204035,
In my tests, this does work with both an environment variable and %S in SecureCRT 6.7.3. What version of SecureCRT did you use previously where this worked correctly? Can you verify the environment variable is still configured properly? (ie: type set at a command prompt) Have you moved your session recently to a different folder within the Connect dialog?
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Hi all,
As a note, there is now a pre-release build of SecureCRT available that will display the location SecureCRT is attempting (for the logon script) as opposed to the generic Failed to open script file dialog. If anyone wishes for me to make the pre-release build available to them, please write support@vandyke.com and include the following:
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#4
|
|||
|
|||
![]()
I'm on a system with a licensed version of SecureCRT 7.1.2 (x64 build 316) and it is not parsing the %USERNAME% Windows variable in a script.
Example I'm trying to use: Code:
g_EnvUser = "%USERNAME%" def main() crt.Dialog.MessageBox("Username is: " + g_EnvUser) result1 = crt.Dialog.MessageBox("Did it get the ENV VAR?", "Username is: " + g_EnvUser, ICON_QUESTION | BUTTON_YESNO | DEFBUTTON2 ) if result1 == IDNO: return main() Does it work? If so, what syntax should I be using? I can't find any examples of using Environment Variables in Scripts. Can you point me to any example scripts that do use Windows ENV Variables for SecureCRT 7.1.2? Thanks. |
#5
|
|||
|
|||
Hi stevo,
I think you misunderstood the prior post. That individual was setting the Logon script option in SecureCRT (Connection / Logon Actions) to use a path for which he had made an environment variable. For example, let's say I create an environment variable in Windows named "stevo" and I make that path equal to C:\Temp\MyPythonScript\ and my session name is "server". Then in that directory I can have server.py as the script I want to run as my logon script. Then in the Logon script field I would have %stevo%%S.py. (I've tried to use color to show how the variables resolve.) ![]() I've just tested this again and it does indeed work. However, what you are trying to do I don't think is possible. The environment variables *within* a script are not resolved by Windows at runtime.
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
![]() |
Thread Tools | |
Display Modes | |
|
|