Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002

    Unanswered: How to issue OS commands in VBScript ?


    I need to issue various Windows line commands (such as ECHO, DELETE, COPY, TYPE, etc) from within a VBScript program.

    I've tried the Run method of the WshShell object but get a message like this-- "The system cannot find the file specified". I take it this means it would run a program residing in a file for me but it won't run memory-resident OS commands.

    I also tried some methods like SendKeys and WScript.Echo but these just display the line commands on the console, and they don't actually execute.

    Is there some way to issue arbitrary Windows OS line commands from within VBScript?

    Thank you for your help.

  2. #2
    Join Date
    Dec 2002


    I answered my own question...

    you use the .Run method, but the string to execute needs to include a reference to the command shell, such as this--

    cmd /K del oldfile.txt
    cmd /K copy filea fileb


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts