随笔分类 - 批处理
摘要:for /? 能看到的比下面详细 获取文件夹的名字 for /f "delims=" %%i in ("%cd%") do set folder=%%~ni for /f "delims=\" %%a in ("%CD%") do set CURR=%%a 1 变量 %0 %1 %2: 参数 类似于
阅读全文
摘要:dir /s/b \\10.24.20.122\xxxx | findstr npm.zip
阅读全文
摘要:1 解压 rem 平铺开@echo off echo 解压%1到%2 7z.exe e %1 -y -o%2 echo 解压%1完成rem 完整目录7z.exe x E:\npm.zip -y -o"C:\Users\AppData\Roaming\npm"\ -aoarem 压缩当前目录到test
阅读全文
摘要:一 修改扩展 1 直接cmd执行 去掉后缀 for /r %a in (*.bt) do ren "%a" "%~na" 修改后缀 for /r %a in (*.bt) do ren "%a" "%~na.test" 2 保存脚本 for /r %%a in (*.bt) do ren "%%a"
阅读全文
摘要:1 下载openjdk https://adoptopenjdk.net/ 2 解压 3 在解压后的目录中 新建批处理文件 color 0a ::删除JAVA_HOME wmic ENVIRONMENT where "name='JAVA_HOME'" delete ::删除ClASSPATH wm
阅读全文
摘要:1 首先想到的是递归遍历目录 筛选出符合条件的文件 dir命令递归遍历目录 /b控制显示格式 /s递归 /ad 只显示目录 dir /b/s .\* 判断文件类型 操作数得用`` rem 取出文件扩展名 %%~XI rem 判断相等 if `%%~XI` equ `.jar`( echo %%I )
阅读全文
摘要:xcopy src target /Y /r /d /k /f /s /exclude:%cd%\xcopy.configxcopy.config\assets\\tet\ 7z.exe a -tzip %target%\target.zip src\* xcopy 使用: https://stac
阅读全文
摘要:1 2 参考: https://msfn.org/board/topic/65204-how-to-get-parent-path-in-bat/
阅读全文
摘要:1 在脚本前面增加下面这行就可以了 %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit 2 %~s0 等符号
阅读全文