如何在Windows cmd(批处理文件)中编写|
(Linux)命令?
我不知道如何在Windows中编写这个小小的Linux脚本:
find -r * |grep *.fd | open
Windows: dir /S ??? open
我真的不知道open
是做什么的。如果它只是用相应的文件启动一个关联的应用程序,那么应该执行以下命令:
for /r %f in (*.fd) do (start "" "%f")
在PowerShell中你可以这样做:
Get-ChildItem -Recurse -Filter *.fd | Invoke-Item
或短:
gci -rec -fi *.fd | ii
windows中的常规命令shell功能不足。然而,Windows Power Shell有能力运行许多类似于*nix Shell的忍者命令。
您可以在MSDN - http://msdn.microsoft.com/en-us/library/aa973757%28v=vs.85%29.aspx上获得有关电源外壳的更多信息
下面是我从Powershell help中搜索到的一个例子:
-------------------------- 示例4 --------------------------
C: PS> get-childitemC:windowssystem32* -include *.txt-recurse | select-string -pattern "Microsoft" -区分大小写
该命令检查目录中的所有文件C:WindowsSystem32子目录使用.txt文件扩展名,对于字符串"微软"。的CaseSensitive参数表示中的"M"微软"必须大写其余的字符必须是小写字母表示匹配。