您当前的位置:首页 > 计算机 > 系统应用 > Windows

展开/折叠文件夹的小工具(cmd脚本)

时间:05-20来源:作者:点击数:

展开/折叠文件夹的小工具(cmd脚本)

fold.cmd

@echo off
setlocal enabledelayedexpansion
set outpath=%~dp0
set outpath=%outpath:~0,-1%_fold
echo %outpath%
if not exist %outpath% md %outpath%
for /f "tokens=*" %%i in ('dir/b/a-d') do (
        set tt=%%i
        set tb=!tt:%~dp0=!
        set tb=%outpath%\!tb:_=\!
        set ta=!tb!
        for %%F in ("!ta!") do set ta=%%~dpF
        if not exist "!ta!" md "!ta!"
        copy "%%i" "!tb!"
)
pause

unfold.cmd

@echo off
setlocal enabledelayedexpansion
set outpath=%~dp0
set outpath=%outpath:~0,-1%_unfold
echo %outpath%
if not exist "%outpath%" md "%outpath%"
for /f "tokens=*" %%i in ('dir/s/b/a-d') do (
        set tt=%%i
        set tt=!tt:%~dp0=!
        copy "%%i" "%outpath%\!tt:\=_!"
)
pause

 

方便获取更多学习、工作、生活信息请关注本站微信公众号城东书院 微信服务号城东书院 微信订阅号
推荐内容
相关内容
栏目更新
栏目热门