无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站广告联系 微信:wuyouceo QQ:184822951
查看: 5015|回复: 3

用WBAT和GET,FIND写的创建新的多层带间隔的长名目录小批处理

[复制链接]
发表于 2005-4-19 21:31:13 | 显示全部楼层 |阅读模式
[这个贴子最后由gotomsdos在 2005/04/20 12:41pm 第 3 次编辑]

这段时间,做综合游戏启动光盘,想实现创建新的多层带间隔的长名目录,需要命令行自动的.,但是又找不到适合的程序,所以就用WBAT和GET,FIND写的创建带间隔的长名目录小批处理: 供参考,
在纯DOS运行成功..,在XP DOS窗口可能不行......(经测试,可以建105个字符(包括"\")的带间隔多层目录, 但\前后不能有间隔,WBAT BOX 可以显示120之内的字符,包括按钮)
要求:加载了DOSLFN
echo off
cls
goto begin
:lfn "to create long name folder with spaces !"   [x]
please input  folder name to creat:
[$ lfn 105                                          ]
                        [show it first] [just create]
:
:begin
call w.bat box @%0:lfn
if  errorlevel 100 goto final
if not "%lfn%"=="" goto  go
wbat box "no input yet ! input ?" input,exit
if errorlevel 2 goto final
goto begin
:go
if  errorlevel 2 goto create
wbat box "%lfn%" continue...
:create
get z "%lfn%" 1
dir "%lfn%" /w/ad|find "%get%"
if not errorlevel 1 goto final
md "%lfn%"
get z "%lfn%" 1
dir "%lfn%" /w/ad|find "%get%"
if not errorlevel 1 goto final
:start
set pos=
set left=%lfn%
set right=
:toleft
wbat box "to search existing directory by allocating ';\';" continue...
get # "%left%" ';\'; /x
set pos=%get%
get z "%lfn%" %pos%
set right=%get%
get r "-" %pos% /w1
get z "%left%" /w%get%
set left=%get%
wbat box "checking^%left%" continue...
get z "%left%" 1
dir "%left%" /w/ad|find "%get%"
if not errorlevel 1 goto exist
wbat box "%left%^doesn';t exist!" continue...
goto  toleft
:exist
wbat box "%left%^exists!" continue...
goto make
:toright
wbat box "succeeded!" continue...
:make
wbat box "now about to create new directory to right!" continue...
if "%right%"=="" goto  end
get # "%right%" ';\';
if "%get%"=="0" goto last
get r "+" %pos% /w%get%
set pos=%get%
get r "-" %pos% /w1
get z "%lfn%" /w%get%
set left=%get%
get z "%lfn%" %pos%
set right=%get%
wbat box "creating^%left%" continue...
md "%left%"
wbat box "checking if succeeded" continue...
get z "%left%" 1
dir "%left%" /w/ad|find "%get%"
if not errorlevel 1 goto toright
goto fail
:last
md "%lfn%"
:end
get z "%lfn%" 1
dir "%lfn%" /w/ad|find "%get%"
if not errorlevel 1 goto ok
:fail
wbat box "FAIL creating new directory !!" retry,back
if errorlevel 2 goto  final
goto start
:ok
wbat box  "SUCCEEDED creating ENTIRE directory !!" finish
:final
发表于 2005-4-20 23:34:18 | 显示全部楼层

用WBAT和GET,FIND写的创建新的多层带间隔的长名目录小批处理

支持原创
回复

使用道具 举报

发表于 2005-4-24 23:16:39 | 显示全部楼层

用WBAT和GET,FIND写的创建新的多层带间隔的长名目录小批处理

   问一下那个get命令干什么的?怎么用?
回复

使用道具 举报

 楼主| 发表于 2005-5-3 19:45:52 | 显示全部楼层

用WBAT和GET,FIND写的创建新的多层带间隔的长名目录小批处理

能解决很多问题的批处理增强程序
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-3-29 17:22

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表