find.exe
在PowerShell控制台外壳程序中使用参数时,哪些参数令人反感?
这些命令可以在cmd.exe
shell中按预期方式工作:
PS C:\Windows\System32\WindowsPowerShell\v1.0> find /i "System.Diagnostics.Process" *.ps1xml
FIND: Parameter format not correct
PS C:\Windows\System32\WindowsPowerShell\v1.0> find /i "System.Diagnostics.Process" *.ps1xml
FIND: Parameter format not correct
PS C:\Windows\System32\WindowsPowerShell\v1.0> C:\Windows\System32\find.exe /i "System.Diagnostics.Process" *.ps1xml
FIND: Parameter format not correct
PS C:\Windows\System32\WindowsPowerShell\v1.0> C:\Windows\System32\find.exe /i "System.Diagnostics.Process" .\DotNetTypes.format.ps1xml
FIND: Parameter format not correct
尝试:
find /i "`"System.Diagnostics.Process`"" *.ps1xml
我使用Sysmon.exe比较了PowerShell.exe
和中的执行cmd.exe
:
对于cmd.exe:
Image: C:\Windows\System32\find.exe
CommandLine: find /i "System.Diagnostics.Process" *.ps1xml
ParentImage: C:\Windows\System32\cmd.exe
对于PowerShell:
Image: C:\Windows\System32\find.exe
CommandLine: "C:\Windows\system32\find.exe" /i System.Diagnostics.Process *.ps1xml
ParentImage: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
我们可以看到在PowerShell中,搜索词周围的引号丢失了,因此,通过添加另一组双引号,它应该可以工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句