Start-Process -ArgumentList with delay

Hi, I’m using a Powershell to run the Win-64 OpenSSL batch but I have some problems.

The basic OpenSSL batch needs to load after it opens and then you can write the command string.

The string works if I do it manually, but in Powershell no.

Here is my code:

Start-Process -FilePath “$mypath/start.bat” -ArgumentList “/c $myString”

I’m afraid the Argument are passed too soon and the OpenSSL isn’t loaded yet (the batch opens). Is there a way to open the batch(like Invoke-Item) and pass the arguments after 4 seconds?

Thanks in advance for the help

Welcome to the forum. :wave:t3:

The process beeing started for a cmd or bat file is CMD.exe. So your command line should look something like this:

Start-Process -FilePath $ENV:ComSpec -ArgumentList "/c $mypath/start.bat"

But I’m afraid it does not work as you may think it does to pass input to this started instance of the CMD console.

You may try to migrate the commands in your *.bat file to proper PowerShell commands and pass the desired input to these commands though.