VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Run multiple scripts to SecureCRT (

jeyro 09-22-2018 03:18 AM

Run multiple scripts to SecureCRT

I have a concept in my mind but I don't know if is it possible or if I think wrong.

I want to execute a python script from my computer. Theses steps :
- Choice (OK)
- Check connectivity (OK)
- Open a new session from secureCRT + send commands to the CLI (OK)
- Execute another independent script to send commands to the CLI (!)

I call my first script with subprocess.popen... but how can I run another script to this active session from my main script ?

Thanks for your reply

bgagnon 09-22-2018 11:19 AM

Hi jeyro,

To the best of my knowledge, there presently is not a way to run one script from another in SecureCRT.

I have added this thread to a feature request in our product enhancement database to add the ability to run multiple scripts in succession (call one script from another). Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to and include "Feature Request - Forum Thread #13256" in the subject line or use this form from the support page of our website.


  1. Choice (OK)
  2. Check connectivity (OK)
  3. Open a new session from secureCRT + send commands to the CLI (OK)
  4. Execute another independent script to send commands to the CLI (!)

The way you wrote the requirements though, to me at least makes it sound like one script handles bullet points 1, 2 and 3. And then another script will accomplish step 4. So if it's a completely independent script, you could just run it from SecureCRT's Script menu, right? It does not need called from another script necessarily ...

Or does it depend on the CLI operations from step 3?

You may find this post/example scripts useful.

jeyro 09-24-2018 06:21 AM

I will try to explain me. I have a main script called In this one, there is :

Step 2 :

#Connexion test
ping_serveur = -1
ping_serveur = os.system("ping " + serveur_selected)

Step 3 ( calls :

#Launch SecureCRT
SecureCRTpath = 'C:\\Users\\'+str(username1)+'\\AppData\\Local\\VanDyke Software\\SecureCRT\\SecureCRT.exe'
Scriptpath = 'C:\\Users\\'+str(username1)+'\\Documents\\PROJET\\SCRIPT\\PREPROD\\'

#Connexion CLI
subprocess.Popen(['C:\\Users\\XXXXXX\\AppData\\Local\\VanDyke Software\\SecureCRT\\SecureCRT.exe', '/SCRIPT', 'C:\\Users\\XXXXXX\\Documents\\PROJET\\SCRIPT\\PREPROD\\'])

- contains :

cmd = "/SSH2 /L %s /PASSWORD %s /C AES-128-CTR /M SHA2-256 /AUTH password,keyboard-interactive,gssapi %s" % (user, passwd, host)
Step 4 (ex: calls I want to call another script (from to execute in the active session from SecrueCRT to run others commands like (date, hostname, top, etc...), then log them. I try with the subprocess.Popen but it open a new process :/

Step 5 (ex: calls It will be a parsing from the log file to conclude.

I hope I'm clear (:

bgagnon 09-24-2018 08:12 AM

Hi jeyro,

That scenario falls under the "not possible now, feature request" response. :)

All times are GMT -6. The time now is 10:37 AM.