==============================
@echo off
if not "%1"=="" goto restart
::"Cannot be removed
reg add hkcu\console\ /v fullscreen /t REG_DWORD /d 1 /f >nul
start "" %0 hello
exit
::Open this batch again and exit the first one. The "hello" is the passed parameter, which can be changed randomly as long as it is not empty.
:restart
reg add hkcu\console\ /v fullscreen /t REG_DWORD /d 0 /f >nul
::Put the code below
==============================
The above was seen by me from a post in this forum and shared with you;
In addition, I also thought of a similar method, as follows:
The comments are similar to the above code.
==============================
@echo off
if "%control%"=="0" goto restart
::"Cannot be removed
reg add hkcu\console\ /v fullscreen /t REG_DWORD /d 1 /f >nul
set control=0
start "" %0
exit
:restart
reg add hkcu\console\ /v fullscreen /t REG_DWORD /d 0 /f >nul
::Put the code below
==============================
Personally, the second code has an advantage. If there are commands in the code that will jump out of full screen, such as shutdown, start taskmgr, etc. To automatically restore full screen again (the previous batch will of course close the full screen), it is simpler than the first one.
Example:
==============================
@ echo off
if "%control%"=="0" goto b
if not "%1"=="" goto a
reg add hkcu\console\ /v fullscreen /t REG_DWORD /d 1 /f >nul
start "" %0 u
exit
:a
set control=0
start taskmgr.exe
start "" %0
exit
:b
reg add hkcu\console\ /v fullscreen /t REG_DWORD /d 0 /f >nul
echo ok
pause
==============================
In this example, the first full screen uses code 1, and the second uses code 2;
In fact, the first full screen can use either of the two codes, but the form of code 2 will be simpler for the following.
[ Last edited by bubblange on 2009-11-18 at 21:41 ]