+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, WScript.Shell Run in Coding and Web Development; I'm a pragmatist and just changed to Exec, StdOut.ReadAll and a file write to get what I wanted, but for ...
  1. #1

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    WScript.Shell Run

    I'm a pragmatist and just changed to Exec, StdOut.ReadAll and a file write to get what I wanted, but for future ref. does anyone know why using Run like this doesn't work?

    x.Run("fred.exe inputfile > outputfile", 0, true);

    That's jscript, but I imagine the issue is generic. The exe runs and if I change that 0 to 1 I get to see a transient dos box in which I see the output i.e. the redirect to file doesn't happen

  2. #2

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115

    Re: WScript.Shell Run

    Ah ha! If you want stdout redirection to work you have to do it something like this:

    x.Run("%comspec% /c fred.exe inputfile > outputfile", 0, true);

  3. #3
    ChrisH's Avatar
    Join Date
    Jun 2005
    Location
    East Lancs
    Posts
    4,999
    Thank Post
    120
    Thanked 280 Times in 258 Posts
    Rep Power
    106

    Re: WScript.Shell Run

    If I am doing a complicated command line I tend to find things work easier if I put that into a string and then use that eg

    Code:
    myCmd= "%comspec% /c fred.exe inputfile > outputfile"
    x.Run(myCmd,0, true);

SHARE:
+ Post New Thread

Similar Threads

  1. Stop users closing bat/cmd shell at logon
    By apeo in forum How do you do....it?
    Replies: 10
    Last Post: 8th May 2007, 12:37 PM
  2. Windows Power Shell
    By mattx in forum Scripts
    Replies: 1
    Last Post: 21st April 2007, 08:11 AM
  3. Censornet Secure Shell Access
    By leon in forum *nix
    Replies: 5
    Last Post: 23rd February 2007, 10:16 PM
  4. Browsing internet through explorer shell
    By woody in forum Windows
    Replies: 2
    Last Post: 28th September 2006, 09:31 AM
  5. Replies: 9
    Last Post: 29th November 2005, 05:48 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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