Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
May 10, 2006
Redirecting STDOUT to STDIN (piping) is supported by CMD.EXE, not Vbscript (WSH).
To pipe the output of an executable to the input of another process in Vbscript simply involves using CMD.EXE to run them.
The location of CMD.EXE is defined by the %comspec% environment variable.
If you wanted to run dsquery user -samid %username% -o dn | dsget user -memberof from a Vbscript, use:
Dim oUserDNset oShell = createobject("wscript.shell")mystr = "dsquery user -samid %username% -o dn | dsget user -memberof"set oUserDN = oShell.exec("%ComSpec% /c
& mystr &
")Wscript.Echo oUserDN.StdOut.readall
You May Also Like