Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. $processName = "notepad"
  2. $processStartFullPath = "c:\windows\system32\cmd.exe"
  3. $processStartArguments = 'hej.txt'
  4. $process = (Get-Process $processName -EA SilentlyContinue | Select ProcessName)
  5.  
  6. if ($process) {
  7. Write-Host -ForegroundColor Green "Arma 3 server is already running - no need to do anything"
  8. } else {
  9. Write-Host -ForegroundColor red "Arma 3 server is not running"
  10. Write-Host "Starting Arma 3 server..."
  11.  
  12. $ps = New-Object System.Diagnostics.Process
  13. $ps.StartInfo.FileName = $processStartFullPath
  14. $ps.StartInfo.Arguments = $processStartArguments
  15. #$ps.StartInfo.RedirectStandardOutput = $True
  16. $ps.StartInfo.UseShellExecute = $false
  17. $newProcess = $ps.Start()
  18.  
  19. Write-Host -ForegroundColor Green "Process $processStartFullPath $processStartArguments was spawned"
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement