@echo off
set number=0
if "%1"=="" (
echo 请勿直接双击本批处理,将BOOT.VDF拖到批处理上运行!
pause
exit /b
)
if not exist %1 (
echo 找不到镜像文件!
pause
exit /b
)
cd /d %~dp0
if exist %systemroot%\system32\imdisk.exe (
goto :NEXT
)
if not exist %systemroot%\system32\imdisk.exe (
call "Imdisk\install.cmd"
)
:NEXT
imdisk -a -b 2048b -m A: -f %~dpnx1
reg load HKLM\111 A:\Windows\System32\config\SYSTEM
for /f "tokens=3 delims= " %%a in ('reg query "HKLM\111\ControlSet001\Enum\ROOT\SYSTEM\0001\Device Parameters\Repository" /v %number%') do (
set ps=%%a)
set ps1=%ps:~508,10000%
set str=%ps1:~0,-4%
echo %str%
pause
set "str=%str:41=A%"
set "str=%str:42=B%"
set "str=%str:43=C%"
set "str=%str:44=D%"
set "str=%str:45=E%"
set "str=%str:46=F%"
set "str=%str:47=G%"
set "str=%str:48=H%"
set "str=%str:49=I%"
set "str=%str:4A=J%"
set "str=%str:4B=K%"
set "str=%str:4C=L%"
set "str=%str:4D=M%"
set "str=%str:4E=N%"
set "str=%str:4F=O%"
set "str=%str:51=Q%"
set "str=%str:52=R%"
set "str=%str:53=S%"
set "str=%str:54=T%"
set "str=%str:55=U%"
set "str=%str:56=V%"
set "str=%str:57=W%"
set "str=%str:58=X%"
set "str=%str:59=Y%"
set "str=%str:5A=Z%"
set "str=%str:61=a%"
set "str=%str:62=b%"
set "str=%str:63=c%"
set "str=%str:64=d%"
set "str=%str:65=e%"
set "str=%str:66=f%"
set "str=%str:67=g%"
set "str=%str:68=h%"
set "str=%str:69=i%"
set "str=%str:6A=g%"
set "str=%str:6B=k%"
set "str=%str:6C=l%"
set "str=%str:6D=m%"
set "str=%str:6E=n%"
set "str=%str:6F=o%"
set "str=%str:71=q%"
set "str=%str:72=r%"
set "str=%str:73=s%"
set "str=%str:74=t%"
set "str=%str:75=u%"
set "str=%str:76=v%"
set "str=%str:77=w%"
set "str=%str:78=x%"
set "str=%str:79=y%"
set "str=%str:7A=z%"
set "str=%str:5C=\%"
set "str=%str:3A=:%"
set "str=%str:2E=.%"
set "str=%str:00=%"
set "str=%str:50=P%"
set "str=%str:70=p%"
echo %number%号内存盘关联镜像路径是%str%(如果显示乱码,不用理会)
echo 更改路径为D:%~pnx1
pause
set str2=%~pnx1
set "str2=%str2:A=41/%"
set "str2=%str2:a=61/%"
set "str2=%str2:B=42/%"
set "str2=%str2:b=62/%"
set "str2=%str2:C=43/%"
set "str2=%str2:c=63/%"
set "str2=%str2:D=44/%"
set "str2=%str2:d=64/%"
set "str2=%str2:E=45/%"
set "str2=%str2:e=65/%"
set "str2=%str2:F=46/%"
set "str2=%str2:f=66/%"
set "str2=%str2:G=47/%"
set "str2=%str2:g=67/%"
set "str2=%str2:H=48/%"
set "str2=%str2:h=68/%"
set "str2=%str2:I=49/%"
set "str2=%str2:i=69/%"
set "str2=%str2:P=50/%"
set "str2=%str2:p=70/%"
set "str2=%str2:Q=51/%"
set "str2=%str2:q=71/%"
set "str2=%str2:R=52/%"
set "str2=%str2:r=72/%"
set "str2=%str2:S=53/%"
set "str2=%str2:s=73/%"
set "str2=%str2:T=54/%"
set "str2=%str2:t=74/%"
set "str2=%str2:U=55/%"
set "str2=%str2:u=75/%"
set "str2=%str2:V=56/%"
set "str2=%str2:v=76/%"
set "str2=%str2:W=57/%"
set "str2=%str2:w=77/%"
set "str2=%str2:X=58/%"
set "str2=%str2:x=78/%"
set "str2=%str2:Y=59/%"
set "str2=%str2:y=79/%"
set "str2=%str2:Z=5A/%"
set "str2=%str2:z=7A/%"
set "str2=%str2:.=2E/%"
set "str2=%str2::=3A/%"
set "str2=%str2:\=5C/%"
set "str2=%str2:J=4A/%"
set "str2=%str2:K=4B/%"
set "str2=%str2:k=6B/%"
set "str2=%str2:L=4C/%"
set "str2=%str2:l=6C/%"
set "str2=%str2:M=4D/%"
set "str2=%str2:m=6D/%"
set "str2=%str2:N=4E/%"
set "str2=%str2:n=6E/%"
set "str2=%str2:O=4F/%"
set "str2=%str2:o=6F/%"
set "str2=%str2:/=00%"
set np=%ps:~0,508%44003A00%str2%0000
reg add "HKLM\111\ControlSet001\Enum\ROOT\SYSTEM\0001\Device Parameters\Repository" /v %number% /t REG_BINARY /d %np% /f
for /f "tokens=3* delims= " %%a in ('reg query HKLM\system\MountedDevices /v \Dosdevices\%~d1') do (
reg add HKLM\111\MountedDevices /v \Dosdevices\D: /t REG_BINARY /d %%a /f)
reg unload HKLM\111
imdisk -D -m A:
echo 处理完毕!按任意键退出!
pause>nul
exit /b