if not "%1%"=="" goto okArguments
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo -----------------------------------------------------------------------
@echo 兄弟,你没输入参数,我没法干活,我可是带详细指令的批处理,例如:d:\mydoc\win7_lite 4 marc。我自行退出,或你按Ctrl+C 中止。
pause
goto ESC
:okArguments
if not exist d:\lite\del_index.txt goto noDelLog
del /f /s /q d:\lite\del_index.txt
:noDelLog
if not exist d:\lite\mount goto mdMount
::必须先清除子目录中权限较高的文件夹,才可以清除本级文件夹,Windows的恶心约定,并且微软还为我设了先有鸡还是先有蛋的问题,执行第一遍错误百出,我执行了两次,当然高手可能不怕。友情提示,第一遍时,错误百出,让它多飞一会,没什么大不了!
dir d:\lite\mount /ad /b /s >d:\lite\del_index.txt
for /f %%i in (d:\lite\del_index.txt) do (@echo y|takeown /f %%i /r >d:\lite\log.txt)
for /f %%i in (d:\lite\del_index.txt) do (@echo y|cacls %%i /t /g %2:f >>d:\lite\log.txt)
for /f %%i in (d:\lite\del_index.txt) do rd %%i /s /q
@echo y|takeown /f d:\lite\mount /r
@echo y|cacls d:\lite\mount /t /g %2:f
rd d:\lite\mount /s /q
dir d:\lite\mount /ad /b /s >d:\lite\del_index.txt
for /f %%i in (d:\lite\del_index.txt) do (@echo y|takeown /f %%i /r >d:\lite\log.txt)
for /f %%i in (d:\lite\del_index.txt) do (@echo y|cacls %%i /t /g %2:f >>d:\lite\log.txt)
for /f %%i in (d:\lite\del_index.txt) do rd %%i /s /q
@echo y|takeown /f d:\lite\mount /r
@echo y|cacls d:\lite\mount /t /g %2:f
rd d:\lite\mount /s /q
:mdMount
md d:\lite\mount
if exist d:\lite\imagex.exe goto existImagex
@echo 兄弟,复制下imagex吧,要不我开不了工!我等着你,OK了,我继续。
pause
:existImagex
::我要删除同名文件,甚至是上一次已经做好的,呵呵!
del /f /s /q d:\lite\win7_lite.wim
del /f /s /q d:\lite\del_index.txt
@echo 马上要开始正式工作了!