I use batch file to do installs . How do I tell PowerShell wait until user response enter key or Y.
I am not that picky about which way this is done. I just like simple coding solutions.
in a batch file I use this command
timeout /t -1
So, you have a PoSH script calling a batch file to do installs?
You can use PoSH directly to do this, via the Start-Process cmdlet, that has a -wait switch.
So, your .ps1 (running in the console), calls a .bat (from the console to cmd.exe) and the .bat has a confirmation requirement before it is allowed to continue and return control back to the ,ps1?
It's really important that you show your code here to better ascertain what needs to really be addressed.
In most external calls from PoSH, you are not looking for keypress responses, but error code responses.
So, since you have not posted your code, I would suggest you look at the Start-Process cmdlet to call your batch file and leveraging the -wait switch.
# Get parameters, examples, full and Online help for a cmdlet or function
(Get-Command -Name Start-Process).Parameters Get-help -Name Start-Process -Examples Get-help -Name Start-Process -Full Get-help -Name Start-Process -Online
See these for how to use PoSH with external commands
Personally, I wrote a function that I keep in my profile that allows me to call these external .exe vs having to type the strings each time. You can do that as I did from the above information linked to.
btw it did take me a while to realize Posh was powershell - I have broken down the problem to its simplest components in order to get the quickest answer .
thank you for your time
thanks I will figure it out
I may be ancient, but I am not stupid
Yep, Typing PowerShell is just to long. 8^}
I am in the ancient class as well. I started my career in IT, in the late 1970's, before all this new fangled stuff ever was a thing. Ahhh... the IBM 360/370 JCL FORTRAN/OBOL/CICS/Assembler days. Simpler times. 8^}