Home Forums Programming Powershell How to work with CMD prompt and prompt selections RE: How to work with CMD prompt and prompt selections

  • That trick works with the exe that I just created will see if it works with the one I actually have to run it against. Thanks!

    Jeff Moden (5/26/2012)


    It sometimes depends on the executable, but I've had good luck with this problem in the past.

    First, make a text file called Y.txt. It should contain 1 character. That character is "Y" without the quotes. Make sure that when you enter the character to press the [Enter] key after the "Y" in whatever editor you're creating the file in.

    Then, when you execute the exe, include a redirected input from the Y.txt file. From a command prompt, it would look like the following...

    C:\DB Tools\DBCleaner\DbCleaner.exe < C:\somepath\Y.txt

    ... where "C:\somepath\" is the actual folder that the Y.txt file lives in.

    I don't know if "Start-Process -filePath" will handle such redirection, though.

    A clever person solves a problem. A wise person avoids it. ~ Einstein
    select cast (0x5365616E204465596F756E67 as varchar(128))