View Single Post
  #12  
Old 09-15-2020, 09:27 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,031
Quote:
Originally Posted by dlong View Post
Would anyone please point me in the right direction on syntax? I am trying both the shell.Run and Process.Start routines to effect a session, but my VB.NET error says 'file not found'.

Code:
  Dim shell
        shell = CreateObject("WScript.Shell")
        shell.Run("""C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe /Script H:\DH\secureCRT_Scripts\SESSION_FROM_VB_1.vbs")
Your quotations are unbalanced such that what you've entered wouldn't work from CMD.exe either.
  • You are missing an embedded/escaped quote after the path to SecureCRT.exe.
    As shown below, see the embedded/escaped quotes in red how they are matched up surrounding the path for SecureCRT.exe?
    Code:
      Dim shell
            shell = CreateObject("WScript.Shell")
            shell.Run("""C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe"" /Script H:\DH\secureCRT_Scripts\SESSION_FROM_VB_1.vbs")
  • You should also consider embedding/escaping the path to your script file so that if you ever decide to change its name or location to something that has spaces in it, the embedded quotes will save you.
    As shown below, see the embedded/escaped quotes in purple how they are matched up surrounding the path for the script file?

    Code:
      Dim shell
            shell = CreateObject("WScript.Shell")
            shell.Run("""C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe"" /Script ""H:\DH\secureCRT_Scripts\SESSION_FROM_VB_1.vbs""")
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support