I made a simple batch script with two diff options, it kinda annoys me that it covers my whole screen although there are 2 lines visible. It would be cool if someone teaches me how to edit the script so that it opens in a smaller (resized window). This is my current script:
@echo off
title Changing Configs..
:main
echo 1 = trade time
echo 2 = grind time
set /p ibo=
if %ibo% == 1 goto trade
if %ibo% == 2 goto grind
:trade
ren "config.yml" "config - nakano.yml"
ren "config - senpai.yml" "config.yml"
pause
exit
:grind
ren "config.yml" "config - senpai.yml"
ren "config - nakano.yml" "config.yml"
pause
exit
The resulting icon can be moved to the desktop or pinned to the taskbar by dragging to the taskbar.
Or instead, you could rewrite your code so it doesn't ask any questions and just does the job. If you only have 2 choices, why not check which is current, change to the other, and report which one is now the current option?
The following code:
- Verifies that copies of both the senpai and nakano configs exist before making any changes.
- Checks if the file "Nakano.Active" exist, if so then it does the code to switch to senpai, else it assumes senpai is active and does the code to switch to nakano.
- Replaces the current "config.yml" file with the desired configuration.
- Deletes the current "{Mode}.Active" file, "Nakano.Active" or "Senpai.Active", as needed.
- Creates a new Active file, or flag, to indicate the current mode. That is , creates "Senpai.Active" or "Nakano.Active", as needed.
- Echos/reports out what mode it just switch to.
- Waits for 2.25 seconds, giving you the time to see what mode it switched to. Change the 225 to the number of centiseconds you want the code to wait before continuing.
- Executes EXIT which closes the window.
@ECHO OFF
IF NOT EXIST "config - senpai.yml" GOTO :DoExit
IF NOT EXIST "config - nakano.yml" GOTO :DoExit
IF EXIST Nakano.Active (
COPY /Y "config - senpai.yml" "config.yml" >NUL
DEL Nakano.Active 2>NUL
ECHO;Senpai >Senpai.Active
ECHO;Senpai Mode
) ELSE (
COPY /Y "config - nakano.yml" "config.yml" >NUL
DEL Senpai.Active 2>NUL
ECHO;Nakano >Nakano.Active
ECHO;Nakano Mode
)
REM Pause for 2.25 seconds
SET Centiseconds=225
SET "NOWTIME=%TIME:00.=%"
SET "NOWTIME=%NOWTIME:.=%"
FOR /F "TOKENS=1-3 DELIMS=:" %%G IN ("%NOWTIME::0=:%") DO SET /A "StartCentiseconds=(%%G*60 %%H)*6000 %%I"
SET /A EndCentiseconds=StartCentiseconds Centiseconds
:GetNow
SET "NOWTIME=%TIME:00.=%"
SET "NOWTIME=%NOWTIME:.=%"
FOR /F "TOKENS=1-3 DELIMS=:" %%G IN ("%NOWTIME::0=:%") DO SET /A "NowCentiseconds=(%%G*60 %%H)*6000 %%I"
IF %NowCentiseconds% LSS %StartCentiseconds% SET /A NowCentiseconds=NowCentiseconds 8640000
IF %NowCentiseconds% LSS %EndCentiseconds% GOTO :GetNow
:DoExit
EXIT
CodePudding user response:
As per comments simply add mode 40,10
or similar at start of file
@echo off & mode 40,10
title Changing Configs..
......