1
PowerShell參數是一個空字符串我想通過NodeJS參數中給出的字符串搜索文件。當PowerShell參數不是
param(
[switch]$raw,
[string]$input
)
[string]$file = "*.log"
if($raw) { $file = ".\raws\*.log" }
Get-ChildItem -Recurse -Include $file | select-string $input
我在做什麼錯?
'$ input'是一個[自動變量](https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_automatic_variables),你不應該使用它在您的代碼中的名稱。不知道這是爲什麼它突破,但它肯定是誤導。 – TessellatingHeckler
那就是@TessellatingHeckler。非常感謝你。 – Farcrada
[$ \ _和\ [參數(ValueFromPipeline = $ true)\]]之間的奇怪差異可能重複(http://stackoverflow.com/questions/13502949/strange-difference-between-and-parametervaluefrompipeline-true) –