复制代码
- @echo off
- title 更改WINPE系统PATH
- :Menu
- cls
- call :ShowMemoryInfo
- call :ShowHelp
- echo.
- echo. __________________________________________________________
- echo.
- echo. 选项
- echo.
- echo. [1] 显示分区信息
- echo. __________________________________________________________
- echo.
- echo. [2] 加载以前配置
- echo. __________________________________________________________
- echo.
- echo. [3] 取消
- echo. __________________________________________________________
- echo.
- echo.
- choice /C:123 /M "> 请按键选择 "
- if %errorlevel% equ 1 goto CreateConfig
- if %errorlevel% equ 2 goto LoadConfig
- if %errorlevel% equ 3 goto Quit
- pause
- exit /b
- :CreateConfig
- cls
- call :ShowMemoryInfo
- set drives=
- setlocal ENABLEDELAYEDEXPANSION
- for /f "skip=1 tokens=1-4" %%A in ('wmic path Win32_Volume where "DriveLetter<>NULL" get Name^,FreeSpace^,Capacity^,Label') do (
- echo.%%D %%C %%A %%B
- set drives=!drives!%%D
- )
- set "drives=%drives::\=%"
- echo.
- choice /c %drives% /m "请选择分区:"
- set /a start=%errorlevel%-1
- set drive=!drives:~%start%,1!
- set vhd=%drive%:\PETMP.VHD
- echo 创建VHD: %vhd%
- set tmpfile="%temp%\~%random%~.txt"
- >%tmpfile% (
- echo create vdisk file=%vhd% maximum=128000 type=expandable
- echo select vdisk file=%vhd%
- echo attach vdisk
- echo clean
- echo convert gpt
- echo create partition primary
- echo format fs=NTFS label="PETMP" quick
- echo assign letter=Y
- echo exit
- )
- diskpart /s %tmpfile%
- del %tmpfile%
- call :SetEnvironment
- endlocal
- pause
- goto Menu
- exit /b
- :LoadConfig
- cls
- call :ShowMemoryInfo
- set vhd=
- for /f "skip=1 tokens=1" %%A in ('wmic path Win32_Volume where "DriveLetter<>NULL" get Name') do (
- if exist "%%APETMP.VHD" set vhd=%%APETMP.VHD
- )
- if not defined vhd (
- echo.未找到PETMP.VHD,准备创建...
- pause
- goto CreateConfig
- )
- echo 检测到VHD位置:%vhd%
- set tmpfile="%temp%\~%random%~.txt"
- >%tmpfile% (
- echo select vdisk file=%vhd%
- echo attach vdisk
- echo assign letter=Y
- echo exit
- )
- diskpart /s %tmpfile%
- del %tmpfile%
- call :SetEnvironment
- pause
- goto Menu
- exit /b
- :SetEnvironment
- SETX USERPROFILE Y:\User
- SETX APPDATA Y:\User\AppData\Roaming
- SETX ALLUSERSPROFILE Y:\ProgramData
- SETX CommonProgramFiles "Y:\Program Files\Common Files"
- SETX CommonProgramFiles(x86) "Y:\Program Files (x86)\Common Files"
- SETX CommonProgramW6432 "Y:\Program Files\Common Files"
- SETX PUBLIC Y:\User\Public
- SETX ProgramData "Y:\ProgramData"
- SETX ProgramFiles "Y:\Program Files"
- SETX ProgramFiles(x86) "Y:\Program Files (x86)"
- SETX ProgramW6432 "Y:\Program Files"
- SETX TEMP Y:\Windows\TEMP
- SETX TMP Y:\Windows\TEMP
- exit /b
- :Quit
- choice /C YN /M "是否退出?"
- if %errorlevel% equ 1 exit /b
- if %errorlevel% equ 2 goto Menu
- exit /b
- :ShowMemoryInfo
- echo.=========================== 当前内存信息(KB) ====================================
- wmic OS get FreePhysicalMemory,FreeVirtualMemory,TotalVisibleMemorySize,TotalVirtualMemorySize /format:table
- echo.============================================================================
- exit /b
- :ShowHelp
- echo.***************************************************************************
- echo.** 减少X盘写入降低内存占用,小内存电脑可以运行更多软件。可保存winpe用户数据 *****
- echo.***************************************************************************
- exit /b
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |