I made some time ago a stripped-down version of PE. I just wanted it to do one thing: after booting, use the batch file startnet.cmd to find the backup file sn.sna in the snap directory of the last partition, and use snapshot.exe to restore the system. But the black window of startnet.cmd wasn't too nice. Since startnet.cmd is special in PE, as soon as it exits, PE will restart. So I simply wanted to make it look nicer, so I added statements to change the window size. But in PE, it prompted "mode is not a valid external command...", realizing that mode.com might have been stripped down. So I copied the normal mode.com file to my PE. This time there was no error, but the window was still that big black window. mode.com didn't seem to work. I guessed there were other things stripped down. I searched online but didn't find anything. So I had to come here to ask you all for help. Please take some time and give me some pointers.
Attached is my code. See if there's any room for optimization.
[ Last edited by snai9 on 2020-11-16 at 14:39 ]
Attached is my code. See if there's any room for optimization.
@echo off
title System Recovery
set a=10
:re
set /a a+=1
mode con: cols=%a% lines=3
if %a% lss 42 goto re
echo ------System recovery is in progress, you don't need to do anything!-------
echo ------The system will automatically restart after the recovery progress reaches 100%% -------
for %%b in (c d e f g h i j k l m n o p q r s t u v w x y z) do if exist %%b:\windows\explorer.exe set sd=%%b
for %%a in (i h g f e d ) do (
for /f "delims=" %%i in ('dir /s/a/b/a-d "%%a:\snap\sn.sna" 2^>nul') do (
%%~dpi\snapshot.exe %%~dpi\sn.sna %sd%: -go -y --autoreboot:any
)
)
exit
[ Last edited by snai9 on 2020-11-16 at 14:39 ]
