如何检索当前在PowerShell中运行的函数的名称?这是我想要的一个例子:
Function write-FunctionName
{
write-host "The name of this function is: *SomethingGoesHereButWhat?*"
}
Run Code Online (Sandbox Code Playgroud)
然后,当我执行它时,它将显示:
>write-FunctionName
The name of this function is: write-FunctioName
>
Run Code Online (Sandbox Code Playgroud)
可以这样做吗?如果是这样的话?
如何在PowerShell中的字符串数组中找到匹配的字符串:
例:
$Arr = "1 string first",
"2 string second",
"3 string third",
"4 string fourth"
Run Code Online (Sandbox Code Playgroud)
使用此示例,我希望返回:
" string "
Run Code Online (Sandbox Code Playgroud)
我想使用它来查找文件名的匹配部分,然后删除文件名的那一部分(例如从一组mp3文件中删除艺术家的名字),而不必指定应该替换文件名的哪一部分手动.
powershell ×2