删除日志文件中的 "caption="
Get rid of "caption=" in log file
目前还将操作系统放入日志文件中,我正在使用以下命令(最适合我的需要):
wmic os get caption /value | find "Caption=" >>c:\log.log
日志中的输出将是:
Caption=Microsoft Windows 7 专业版
有什么方法可以从日志中删除 "Caption="?
如果没有 /value
,您可以使用 findstr
过滤不需要的行
wmic os get caption | findstr /v /r /c:"^$" /c:"^Caption" >> c:\log.log
或者使用 /value
,您可以使用 for /f
命令过滤输出,在等号
中拆分行
(
for /f "tokens=2 delims==" %%a in ('wmic os get caption /value') do echo %%a
) >>c:\log.log
目前还将操作系统放入日志文件中,我正在使用以下命令(最适合我的需要):
wmic os get caption /value | find "Caption=" >>c:\log.log
日志中的输出将是: Caption=Microsoft Windows 7 专业版
有什么方法可以从日志中删除 "Caption="?
如果没有 /value
,您可以使用 findstr
wmic os get caption | findstr /v /r /c:"^$" /c:"^Caption" >> c:\log.log
或者使用 /value
,您可以使用 for /f
命令过滤输出,在等号
(
for /f "tokens=2 delims==" %%a in ('wmic os get caption /value') do echo %%a
) >>c:\log.log