Mohammed Al-Aazawy
Mohammed Al-Aazawy

Reputation: 11

How to separate variable in a variable in powershell?

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?

Upvotes: 0

Views: 47

Answers (1)

3N16M4
3N16M4

Reputation: 73

You can try like this

"Username:{0} Password:{1}" -f $username , $pass

Upvotes: 1

Related Questions