如何使用给定参数中的全局模式使命令字符串工作?
powershell.exe -c“&‘c:\wind?ws\System32 32\mor.com’C:\path\to\something.txt findstr‘C:\path\to\something.txt findstr’C:\path\to\something.txt--这是可行的。
这就是我想要做的,例如:
powershell.exe -c“&‘c:\档?ws\System32 32\mor.com’C:\wind?ws\w?n.ini \ findstr‘某样东西’”
我试过使用另一种方法,但似乎被错误地解释了
发布于 2022-05-31 09:06:58
在cmd中,仅在路径的最后一个元素中可以使用全局通配符 (如*和? )。
以下是(一些)等价的替代方案:
more.com和findstr.exe:powershell.exe -nopro -c "& 'c:\wind?ws\Syst?m32\mor?.com' (Resolve-Path C:\wind?ws\w?n.ini) | findstr 'fil ext app'"16位应用程序支持扩展 文件的;
powershell.exe -nopro -c "(Get-Content C:\wind?ws\w?n.ini) -match 'fil|ext|app'",用于16位应用程序支持扩展 文件。
https://serverfault.com/questions/1102113
复制相似问题