I have a Java program which I would like to launch as a background process from a PowerShell script, similar to the way a daemon runs on Linux. The PowerShell script needs
Use jobs for this:
Start-Job -ScriptBlock { & java -jar MyProgram.jar >console.out 2>console.err }
Another option would be Start-Process:
Start-Process java -ArgumentList '-jar', 'MyProgram.jar' ` -RedirectStandardOutput '.\console.out' -RedirectStandardError '.\console.err'