Menu

Command Line Scripting

General
Nate Walz
2017-12-07
2017-12-08
  • Nate Walz

    Nate Walz - 2017-12-07

    One of our dBase V programs calls a VB Script. code (RUN CSCRIPT EMAIL.VBS). In DOS this works. In vDOS I get an error "Bad Command or File Name". Is this possible with vDOS, or can you recommend a way to get this to work? Thanks, Nate

     
    • Jos Schaars

      Jos Schaars - 2017-12-07

      CScript.exe isn’t found by the vDos command shell due to a missing path, it’s not Windows CMD. Your program would never run in plain DOS, only NTVDM. Add CMD after RUN, or make CScript.exe available by a path setting.

      Jos

       
  • Nate Walz

    Nate Walz - 2017-12-08

    Thank you Jos, very helpful!

     
  • Nate Walz

    Nate Walz - 2017-12-08

    Adding CMD after RUN works, but it requires the user to exit CMD and return to the program in vDOS. It does not automatically return to vDOS.

    I was not able to make CScript.exe available by a path setting. But, I was able to copy CScript.exe to the current dBase directory and it worked. I think I am getting confused with the path setting for vDOS vs dBase.

    In my dBase program I have tried adding:
    SET PATH TO C:\WINDOWS\SYSTEMS32
    RUN CSCRIPT EMAIL.VBS
    This returns a BAD COMMAND error

    I also tried adding this to the autoexec.txt:
    USE M: C:\WINDOWS\SYSTEM32
    Then adding this to the dBase program:
    SET PATH TO M:\
    RUN CSCRIPT EMAIL.VBS

    I know I am missing something very simple here, can you help?

    Thanks

     
    • Jos Schaars

      Jos Schaars - 2017-12-08

      Did you try RUN CMD /C CSCRIPT EMAIL.VBS (I forgot the /C)?

      dBase runs in the virtual vDos PC. If there’s no C:\WINDOWS\SYSTEM32 in that, the SET command just leads to an invalid path.
      The RUN command starts the DOS command shell (command.com) and passes CSCRIPT EMAIL.VBS to it. In the command shell there’s no PATH set to M:\, so it can’t evaluate CSCRIPT. SET PATH TO M:\ in dBase doesn’t set a path in the command shell. It seems dBase specific: Where to alternatively find files that are refered to in dBase.

      You would have to do SET PATH M:\ in autoexec.txt, or at least before dBase is started. Or use RUN M:\CSCRIPT EMAIL.VBS. The vDos command shell will then find CScript.exe, detect it’s a Windows program, and start it outside the vDos window.

      RUN CMD /C CSCRIPT EMAIL.VBS will start the vDos command shell, starting the Windows command shell, that will then figure out what to do with the rest (/C CSCRIPT EMAIL.VBS) in its own (Windows) context, with a PATH ....;C:\WINDOWS\SYSTEMS32;...
      RUN M:\CSCRIPT EMAIL.VBS will also start the vDos command shell, but that will start CScript.exe directly, that will then handle the remaining (EMAIL.VBS), of course also in the Windows context since it is a Windows program.

      Jos

       
MongoDB Logo MongoDB