Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $processName = "notepad"
- $processStartFullPath = "c:\windows\system32\cmd.exe"
- $processStartArguments = 'hej.txt'
- $process = (Get-Process $processName -EA SilentlyContinue | Select ProcessName)
- if ($process) {
- Write-Host -ForegroundColor Green "Arma 3 server is already running - no need to do anything"
- } else {
- Write-Host -ForegroundColor red "Arma 3 server is not running"
- Write-Host "Starting Arma 3 server..."
- $ps = New-Object System.Diagnostics.Process
- $ps.StartInfo.FileName = $processStartFullPath
- $ps.StartInfo.Arguments = $processStartArguments
- #$ps.StartInfo.RedirectStandardOutput = $True
- $ps.StartInfo.UseShellExecute = $false
- $newProcess = $ps.Start()
- Write-Host -ForegroundColor Green "Process $processStartFullPath $processStartArguments was spawned"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement