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?

1
  • 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: stackoverflow.com/a/4988239/45375 Commented Mar 23, 2020 at 23:01

1 Answer 1

1

You can try like this

"Username:{0} Password:{1}" -f $username , $pass
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.