$Variable = Read-Host "Enter thing" -AsSecureString
Run Code Online (Sandbox Code Playgroud)
将提示您输入并将其保存为变量的安全字符串。如何解密安全字符串变量?
PS C:\Users\Todd> $Variable
System.Security.SecureString
Run Code Online (Sandbox Code Playgroud) switch在 PowerShell 中就像一个不太复杂的if elseif语句,但else不起作用。还有什么我可以做的吗?
switch ("test") {
"1" {"2"}
"2" {"1"}
} else {"other"}
Run Code Online (Sandbox Code Playgroud)
给出错误
else : The term 'else' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:4 char:3
+ } else {"other"}
+ ~~~~
+ CategoryInfo : ObjectNotFound: (else:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : …Run Code Online (Sandbox Code Playgroud) powershell ×2