tags:

views:

5482

answers:

3

For example; with the old command prompt it would be:

cmd.exe /k mybatchfile.bat

Thanks.

John.

+10  A: 

Drop into DOS (or indeed PowerShell itself) and type this:

powershell -?

You'll see that powershell.exe has a "-noexit" parameter which tells it not to exit after executing a "startup command".

Matt Hamilton
+4  A: 

Thanks, Matt, that's just the job. It also needs you to specify the directory of the batch file so the exact conversion is:

powershell.exe -noexit .\mybatchfile.bat

John.

John Richardson
A: 

how do I execute a batch file on remote machines using powershell. I want to update the windows GAC (assembly) folder with some assemblies on multiple machines. I can update the GAC using a batch file but I want to run this batch file on all the machines.

Thanks,

This should be a new post topic, not an answer to this topic. Regardless, see this link: http://technet.microsoft.com/en-us/library/ff730958.aspx
Steve