如何在Windows cmd(批处理文件)中编写|
(Linux)命令?
我不知道如何在Windows中编写这个小小的Linux脚本:
find -r * |grep *.fd | open
在Windows中:
dir /S ??? open
答案 0 :(得分:2)
我真的不知道open
做了什么。如果它只是使用相应的文件启动关联的应用程序,那么以下应该这样做:
for /r %f in (*.fd) do (start "" "%f")
在PowerShell中,您可以执行以下操作:
Get-ChildItem -Recurse -Filter *.fd | Invoke-Item
或更短:
gci -rec -fi *.fd | ii
答案 1 :(得分:0)
Windows中的常规命令shell缺乏功能和功能。但是,Windows Power Shell能够运行许多类似于* nix shell的忍者命令。
您可以在MSDN上获得有关power shell的更多信息 - http://msdn.microsoft.com/en-us/library/aa973757%28v=vs.85%29.aspx
以下是我从Powershell帮助中搜索的一个示例:
--------------------------例4 ------------------- -------
C:\ PS>得到-childitem c:\ windows \ system32 * -include * .txt -recurse | select-string -pattern“Microsoft”-casesensitive
此命令检查中的所有文件 C:\ Windows \ System32的子目录 .txt文件扩展名,用于 字符串“Microsoft”。 CaseSensitive 参数表示'M'在 '微软'必须资本化 其余的人物必须是 匹配发生的小写。