China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 10:17
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Batch processing cannot change the window style View 4,616 Replies 0
Original Poster Posted 2020-11-16 14:37 ·  中国 湖北 宜昌 联通
新手上路
Credits 4
Posts 1
Joined 2016-12-26 14:49
9-year member
UID 182013
Gender Male
Status Offline
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.


@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 ]
Forum Jump: