home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.comp.os.windows-xp      Actually wasn't too bad for a M$-OS      17,273 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 16,835 of 17,273   
   VanguardLH to R.Wieser   
   Re: piping / redirecting into a vbs scri   
   22 Apr 24 11:55:15   
   
   XPost: alt.windows7.general   
   From: V@nguard.LH   
      
   "R.Wieser"  wrote:   
      
   > Using XPsp3.   
   >   
   > A few days ago I tried to redirect some commandline output into a   
   > vbscript, which than should be able to read it using   
   > "wscript.stdin.readline".   
   >   
   > Examples:   
   > echo hello | myvbscript   
   > myvbscript < data.txt   
   >   
   > Alas, all I got was an "invalid handle" error. :-(   
   >   
   > The thing is, it works well enough when I explicitily specify wscript   
   > like this   
   >   
   > echo hello | wscript.exe myvbscript.vbs   
   > wscript.exe myvbscript.vbs < data.txt   
      
   In your first example, you specify "myvbscript" instead of   
   "myvbscript.vbs".  Can't have a filetype association (to a handler aka   
   script interpreter) without an extension on the filename.  However, I'm   
   not sure filetype association works in piped/redirected stdout, but you   
   could try it.  I suspect you must execute a program first to provide   
   piping or redirection (to have stdin and stdout available by the   
   program's process).  By the time the program (filetype handler) runs,   
   assuming it does, you've already attempted piping or stdout before the   
   program has loaded.   
      
   echo hello | myvbscript.vbs   
   myvbscript.vbs < data.txt   
      
   Not sure you can pipe or redirect stdin to a file.  Has to be to a   
   program.  myvbscript and myscript.vbs are just text files, not   
   executables.  They are text files that something else must interpret.   
   Looks like you need to pull stdin or push stdout to wscript.exe, a   
   program, not to a file.   
      
   textfile1 | textfile2   
   Doesn't make sense.  No executable to pull stdin or push stdout.   
      
   textfile2 < textfile1   
   Also doesn't make sense.  Files don't have stdin or stdout streams.   
      
   Somewhere a program must be involved to accept stdin or push stdout.   
   Files don't push (stdout) or pull (stdin) anything.  You read or write   
   to files, and that's by using some program.  There's nothing about a VBS   
   file.  It's just a text file.  Need a handler to intrepet them.   
      
   As mentioned, you could try specifying the .vbs extension hoping the   
   filetype handler will pickup the script interpretation, and manage to   
   intercept stdin or stdout before  the interpreter reads the .vbs file.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca