|
回复 #381 Plantsoot 的帖子
谢谢老大,如果这个也支持将U盘可见区或硬盘可见区的文件取出到P盘就更好了。。。
这样的话只需要弄个文件列表,获取文件列表文件并和可用内存进行比较,然后决定是否映射内存盘P盘
方便拔除U盘,外置可以取出到内存盘中
我希望的功能基本实现了,只是cmd代码太冗余了
下面是网上找到的几个批处理简单整合的
- @echo off
- color 0a
- cd /d "%~dp0"
- if exist %windir%\tools.cmd (del /f /s /q %windir%\tools.cmd)
- if exist "%~dp01.ICO" (echo @echo off>>%windir%\tools.cmd)
- if exist "%~dp01.ICO" (echo color 0a>>%windir%\tools.cmd)
- if exist "%~dp01.ICO" (echo md "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- if exist "%~dp01.ICO" (echo copy /y "%~dp01.ICO" "Y:\PETOOLS">>%windir%\tools.cmd)
- if exist "%~dp0SETUP.CMD" (echo copy /y "%~dp0SETUP.CMD" "Y:\PETOOLS">>%windir%\tools.cmd)
- if exist "%~dp0图文工具\Boilsoft_Screen_Recorder.WIM" (echo copy /y "%~dp0图文工具\Boilsoft_Screen_Recorder.WIM" "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- if exist "%~dp0图文工具\Easy_GIF_Animator.WIM" (echo copy /y "%~dp0图文工具\Easy_GIF_Animator.WIM" "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- if exist "%~dp0图文工具\Foxit_Editor.WIM" (echo copy /y "%~dp0图文工具\Foxit_Editor.WIM" "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- if exist "%~dp0图文工具\Foxit_Reader.WIM" (echo copy /y "%~dp0图文工具\Foxit_Reader.WIM" "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- if exist "%~dp0图文工具\WPS2012.WIM" (echo copy /y "%~dp0图文工具\WPS2012.WIM" "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- if exist "%~dp0图文工具\搜狗手写.exe" (echo copy /y "%~dp0图文工具\搜狗手写.exe" "Y:\PETOOLS\图文工具">>%windir%\tools.cmd)
- echo exit>>%windir%\tools.cmd
- cls
- if exist %windir%\tools.txt (del /f /s /q %windir%\tools.txt)
- if exist "%~dp01.ICO" (echo %~dp01.ICO>>%windir%\tools.txt)
- if exist "%~dp0SETUP.CMD" (echo %~dp0SETUP.CMD>>%windir%\tools.txt)
- if exist "%~dp0图文工具\Boilsoft_Screen_Recorder.WIM" (echo %~dp0图文工具\Boilsoft_Screen_Recorder.WIM>>%windir%\tools.txt)
- if exist "%~dp0图文工具\Easy_GIF_Animator.WIM" (echo %~dp0图文工具\Easy_GIF_Animator.WIM>>%windir%\tools.txt)
- if exist "%~dp0图文工具\Foxit_Editor.WIM" (echo %~dp0图文工具\Foxit_Editor.WIM>>%windir%\tools.txt)
- if exist "%~dp0图文工具\Foxit_Reader.WIM" (echo %~dp0图文工具\Foxit_Reader.WIM>>%windir%\tools.txt)
- if exist "%~dp0图文工具\WPS2012.WIM" (echo %~dp0图文工具\WPS2012.WIM>>%windir%\tools.txt)
- if exist "%~dp0图文工具\搜狗手写.exe" (echo %~dp0图文工具\搜狗手写.exe>>%windir%\tools.txt)
- cls
- setlocal enabledelayedexpansion
- for /f "tokens=1* delims= " %%a in (%windir%\tools.txt) do (
- set /a sizes=!sizes!+%%~za
- )
- ::echo %sizes%
- for /f "tokens=1-3" %%a in ("%sizes%") do (
- ::w=0表示小数位后面为0,只保留整数值
- set /a m=0,w=0,n=%%a,b=1048576,nn=n
- )
- :loop
- set /a y=n%%b,t=n/b,n=y*10
- set j=%j%%t%
- if %n% equ 0 goto end
- if %m% geq %w% goto end
- set /a m+=1
- goto loop
- :end
- cls&set ok=%j%
- if %m% neq 0 call set ok=%%j:~0,-%m%%%.%%j:~-%m%%%
- ::echo.&echo %nn% 除以 %b% = %ok%
- echo 目录文件大小为:%ok%MB
- set /a Ysize=ok
- set /a ok+=10
- echo 创建的内存盘大小为:%ok%MB
- fbinst --meminfo-f
- cls
- if %errorlevel% LSS 500 (goto NEXT1)
- ::ECHO %errorlevel%
- cls
- Imdisk.exe -a -s %ok%M -m Y: -p "/fs:fat /y /q"
- PECMD.EXE WAIT 1000
- :NEXT1
- if not exist Y:\ (goto NEXT2)
- if exist %windir%\tools.cmd (start "" /wait %windir%\tools.cmd)
- if exist %windir%\SETUP.WCS (del /f /s /q %windir%\SETUP.WCS)
- echo EXEC =!Y:\PETOOLS\SETUP.CMD>>%windir%\SETUP.WCS
- PECMD.EXE WAIT 200
- PECMD.EXE LINK %%desktop%%\加载更多外置,%windir%\SETUP.WCS,,Y:\PETOOLS\1.ICO
- exit
- :NEXT2
- if exist %windir%\SETUP.WCS (del /f /s /q %windir%\SETUP.WCS)
- echo EXEC =!%~dp0SETUP.CMD>>%windir%\SETUP.WCS
- PECMD.EXE LINK %%desktop%%\加载更多外置,%windir%\SETUP.WCS,,%Curdir%\1.ICO
- exit
复制代码
[ 本帖最后由 zhs509 于 2012-6-19 14:05 编辑 ] |
|