0

This is my code with PHP that passes a variable to a PowerShell script.

Param([string]$username,[string]$pass)

write-output ("username $username password $pass")

The output if I insert username:sam and pass:123 is:

username sam123 password

I want it to be like this:

username sam password 123

How can you do this?

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • 1
    You don't show how the PowerShell code is being invoked from PHP, but I suspect the problem may be that parameters are being passed with `,` as the separator instead of _spaces_, which is what PowerSell requires: https://stackoverflow.com/a/4988239/45375 – mklement0 Mar 23 '20 at 23:01

1 Answers1

1

You can try like this

"Username:{0} Password:{1}" -f $username , $pass
3N16M4
  • 73
  • 10