我想使用命令的输出
wmic cpu get name
返回
Name
Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz
创建文件名。
所以文件名应该像
i3-3240.txt
是否可以使用BAT文件的脚本进行todo?
答案 0 :(得分:2)
要从命令行执行此操作,您可以使用:
for /f "tokens=3 delims= " %i in ('wmic cpu get name') do if not "%i"=="" type nul>%i.txt
或者来自批处理文件:
for /f "tokens=3 delims= " %%i in ('wmic cpu get name') do if not "%%i"=="" type nul>%%i.txt
或者:
for /f "skip=1 tokens=3 delims= " %i in ('wmic cpu get name') do type nul>%i.txt
和
for /f "skip=1 tokens=3 delims= " %%i in ('wmic cpu get name') do type nul>%%i.txt