Computing Staff
  • 0

VBS – Hide Exec

  • 0

Hey, So i am looking to hide an exec windows, but heres the catch, i want to still be able to .stdin to that window so that makes .run out of the question.

anyone have any ideas?

Share

1 Answer

  1. Well, I’ve been thinking about this, and in a fit of rum-based inspiration, I think I’ve hacked something together. The trick is to use two scripts. The first script calls CSCRIPT.exe to run the second script in a hidden console window. It’s in this hidden second script you can do your work.

    Consider the following example:
    A.vbs

    CreateObject("WScript.Shell").Run "cscript B.vbs", 0, True

    B.vbs

    Set i = CreateObject("WScript.Shell").Exec("cmd /c dir c:\ /a/s")
    CreateObject("Scripting.FileSystemObject").OpenTextFile( _
      "out.txt", 2, True).WriteLine i.StdOut.ReadAll

    • 0