and I want to hide the value on console,
What statement is causing the value to be displayed?
Can't you just set it to null when you're done referencing it.
$foo = $null
Is this a scope problem?
$global:foo = $null
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Set-variable -name "foo" -value "doo" -visibility private
I am unable to delete value using remove or clear variable
The use case is, on console I am passing argument list for exe in that arguments I am passing if else loop and value inside in it and I want to hide the value on console, the argument list coming from json template contains command too
and I want to hide the value on console,
What statement is causing the value to be displayed?
Can't you just set it to null when you're done referencing it.
$foo = $null
Is this a scope problem?
$global:foo = $null
Sorry, I have no idea what you are trying to do. What .exe are you running? Are you passing code to this .exe?
Here is a Powershell script that accepts an input parameter and runs a program with that value. Note that what when I run it in the Powershell window, the $foo variable is empty because it's scope was in the script and it's value is gone because the script has terminated.
The character string "/user" displays in the console for 2 reasons.
Note that whoami.exe does not output anything that says "I was called with the /user switch". If the .exe that you are calling displays $foo then you have to capture its output and process it.
$z = &c:\Windows\system32\whoami.exe $foo