Trying to open .vbs script from another .vbs file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moya
    New Member
    • Jul 2010
    • 2

    Trying to open .vbs script from another .vbs file

    I have two vbs files/scripts that we keep separately and run separately. I'm writing a program that'll execute both scripts, but am having trouble. I get the error
    (for line 5) that "The system cannot find the file specified." (code 80070002). I've checked the file path and it all looks good, I've even tried different locatiosn of the same file, but keep getting it. Is there something wrong in my script, or is it an error with my path name.

    Code:
    Option Explicit
    
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "C:\Moya\sfa transformation\codes\SFG Data Dic Latest\vbsFiles\Table.vbs", 7, True
    wscript.echo "C:\Moya\sfa transformation\codes\SFG Data Dic Latest\vbsFiles\Table.vbs"
    
    WshShell.Run "C:\Moya\sfa transformation\codes\SFG Data Dic Latest\vbsFiles\vbsTableColsNew.vbs", 7, True
    wscript.echo "C:\Moya\sfa transformation\codes\SFG Data Dic Latest\vbsFiles\vbsTableColsNew.vbs"
    I've also tried using ScriptStart, but I keep getting error on line 3 that "ScriptStar t" is an undefined variable..

    Code:
    Option Explicit
    
    ScriptStart("C:\Moya\sfa transformation\codes\SFG Data Dic Latest\vbsFiles\Table.vbs")
    
    ScriptStart("C:\Moya\sfa transformation\codes\SFG Data Dic Latest\vbsFiles\vbsTableColsNew.vbs")
    Help appreciated! I feel like I'm making silly mistakes, but if you can catch it, I'd be eternally grateful.
  • Ken Strong

    #2
    Kind of an old thread, but thought I'd try to answer, try putting wscript in front of the file location on line 5 e.g.:

    "wscript c:\Moya\sfa..."

    for the scriptstart I was running into the same problem, which is why I stumbled on this question. Was never able to find a solution.

    Comment

    Working...