[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
回复 1# adfs945


    之前已经有过类似的了,要善于搜索
  1. @echo off
  2. set /p yourprogramname=what your program name:
  3. :start
  4. cd /d "%~dp0"
  5. if not exist %yourprogramname%.txt (
  6.     set /a "fx=0"
  7. )
  8. if exist "%yourprogramname%.txt" (
  9.    set /a "fx=0"
  10.    set /a "b=1"
  11.    set /a "fx=%fx%+1"
  12.    set "OutFile=%yourprogramname%%fx%.txt"
  13. )
  14. if "%fx%" equ "0" (
  15.        set "OutFile=%yourprogramname%.txt"
  16. )
  17. :1
  18. (for /f "delims=" %%i in ('dir /b /a-d *.*') do (
  19.     if "%%i" neq "%OutFile%" (
  20.         echo,%%~ni
  21.     )
  22. ))>"%OutFile%"
  23. if exist "%yourprogramname%0 .txt" (
  24.    ren "%yourprogramname%0.txt" "%yourprogramname%1 .txt"
  25. )
  26. pause >nul
  27. goto start
复制代码
这个脚本会给出一个类似"文件名0.txt"的,如果不用的话就在进下一个循环的时候改掉"文件名1.txt"
QQ 1980286392

TOP

回复 5# 447219071


    怎么有点像GPT的
QQ 1980286392

TOP

回复 17# adfs945


    没事把所有后缀改动一下就行,像*.*
QQ 1980286392

TOP

返回列表