PowerGUI Script Editor, How to pass parameters?

121 Views Asked by At

I'm trying to pass a parameter to my application like (filename.exe -Param Value) but no luck.

I'm trying to capture the parameter with this

Param([Parameter(Mandatory=$true)][string]$message)
write-host $message

Using the command line to execute the compiled script I try to pass in the parameter but it wont work, below is an example. I've also tried with --message, /message nothing works.

C:\Users\OptiPlex\Desktop>Read_Host_Secure_String.exe -message Hello
cmdlet Read_Host_Secure_String.ps1 at command pipeline position 1
Supply values for the following parameters:
message:

Image

1

There are 1 best solutions below

0
Rodu On

The syntax is Myfile.exe -arguments -message Hello