Board logo

标题: [文本处理] 批处理怎样查找后缀为.vmx的文件并在文件最后写入内容? [打印本页]

作者: clock874    时间: 2020-3-5 10:51     标题: 批处理怎样查找后缀为.vmx的文件并在文件最后写入内容?

查找文件夹内所有后缀为vmx的文件,并在文件最后添加内容:
monitor_control.enable_fullcpuid = TRUE
cpuid.1.eax = "00001111111010111111101111111111"
cpuid.1.ebx = "00000000000000000000011011110001"

万分感谢!!!
作者: zaqmlp    时间: 2020-3-5 12:22

  1. @echo off
  2. set info=互助互利,支付宝扫码头像,感谢打赏
  3. rem 有问题,可加QQ956535081及时沟通
  4. title %info%
  5. cd /d "%~dp0"
  6. for /f "delims=" %%a in ('dir /a-d/b/s *.vmx') do (
  7.     echo;"%%a"
  8.     >>"%%a" echo;monitor_control.enable_fullcpuid = TRUE
  9. )
  10. :end
  11. echo;%info%
  12. pause
  13. exit
复制代码

作者: Batcher    时间: 2020-3-5 22:12

回复 1# clock874
  1. @echo off
  2. cd /d "%~dp0"
  3. for /f "delims=" %%i in ('dir /b /s /a-d *.vmx') do (
  4.     > "%%~nxi.BatHome" type "%%i"
  5.     >>"%%~nxi.BatHome" echo,
  6.     >>"%%~nxi.BatHome" echo,monitor_control.enable_fullcpuid = TRUE
  7.     >>"%%~nxi.BatHome" echo,cpuid.1.eax = "00001111111010111111101111111111"
  8.     >>"%%~nxi.BatHome" echo,cpuid.1.ebx = "00000000000000000000011011110001"
  9.     move /y "%%~nxi.BatHome" "%%i"
  10. )
复制代码

作者: clock874    时间: 2020-3-6 16:48

回复 3# Batcher


    辛苦了!!!非常感谢!!!!




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2