Run a Custom Exe in PowerShell

You have a custom exe ( for e.g. IISHelper.exe) that accepts 1 parameter (for e.g. file name - Input.txt) and you want to execute the exe using Microsoft PowerShell. The exe can be output of a console application or any other exe. Notice '&' in the script.
  1. #$script = "C:\IISHelper.exe"  <<This is the location of .exe to be executed>>   
  2. #$csdefFilaPath = "C:\Input.txt" <<This is the parameter that the exe accepts, in this case a file path>>  
  3. Param( $scriptLocation,  
  4. $filePath  
  5. )  
  6. function RunExe()  
  7. {  
  8.    Write-Output "Running exe"  
  9.    & $scriptLocaion $filePath  
  10.    Write-Output "Finished Running exe"  
  11. }  
  12. RunExe