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.
- #$script = "C:\IISHelper.exe" <<This is the location of .exe to be executed>>
- #$csdefFilaPath = "C:\Input.txt" <<This is the parameter that the exe accepts, in this case a file path>>
- Param( $scriptLocation,
- $filePath
- )
- function RunExe()
- {
- Write-Output "Running exe"
- & $scriptLocaion $filePath
- Write-Output "Finished Running exe"
- }
- RunExe