Showing posts with label cmd.exe; powershell; here string;Start-Process. Show all posts
Showing posts with label cmd.exe; powershell; here string;Start-Process. Show all posts

Monday, March 16, 2009

This will be worth some more investigation.  I can send a Powershell array of cmd.exe strings to the cmd.exe interpreter and pass cmd.exe a Powershell "here string" that will passthru a Powershell variable to the cmd.exe interpreter. Be interesting to next see if I can reverse the process.


# writes out time and date from cmd.exe
write "Time and Date from CMD.EXE:" 
$Global:command = 
"time /t",
"date /t"
out-file -inputobject $command -encoding ASCII -filepath $pwd\cmd.txt
Start-Process cmd.exe -argument /Q -nonewwindow -wait -redirectstandardinput $pwd\cmd.txt