How do i save color to a savefile in a batch file on windows 11


rune1

New member
Local time
5:04 PM
Posts
11
OS
Windows 11
i have this code

Code:
Batch:
:menu
color %backroundColor%%textColor%
cls
echo 1. Play
echo.
echo 2. Load
echo.
echo 3. Delete savefile
echo.
echo 4. Settings
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 goto start
if %variable% equ 2 goto load
if %variable% equ 3 goto delete
if %variable% equ 4 goto settings
if %variable% neq 1 goto menu

:load
cls
set /p savename= What is the name of the savefile you want to load:
set /p "page="<%filename%.dat
if exist %savename%.dat goto saveandload
echo.
pause
goto menu

:save
cls
set /p filename= What do you want your savefile to be called:
cls
>%filename%.dat echo %page%
echo Saved.
echo.
pause
goto meny

:saveandload
cls
< %savename%.dat (
set /p page=
)
echo Loaded.
echo.
pause
goto :%page%

:delete
cls
set /p delete="Which savefile do you want to delete?: "
if exist %delete%.dat goto delete1
cls
echo It looks like that savefile does not exist.
echo.
pause
goto menu

:delete1
cls
echo Are you sure you want to delete %delete%.dat?
echo.
echo 1. Yes
echo.
echo 2. No
echo.
set /p yesno="Write the number of your choice: "
if %yesno%==1 goto deleteyes
if %yesno%==2 goto deleteno
goto radera1

:deleteyes
cls
del %delete%.dat
echo You deleted %delete%.dat
echo.
pause
goto menu

:deleteno
cls
echo There is no savefile called %delete%.dat
echo.
pause
goto menu

:settings
cls
echo 1. Text- and backroundcolor
echo.
echo 2. Go back
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 goto textcolor
if %variable% equ 2 goto menu
if %variable% neq 1 goto settings

:textcolor
cls
echo Textcolor
echo.
echo 1. Black
echo.
echo 2. Blue
echo.
echo 3. Grean
echo.
echo 4. Aqua
echo.
echo 5. Red
echo.
echo 6. Purple
echo.
echo 7. Yellow
echo.
echo 8. White
echo.
echo 9. Gray
echo.
echo 10. Light blue
echo.
echo 11. Light grön
echo.
echo 12. Light aqua
echo.
echo 13. Light red
echo.
echo 14. Light purple
echo.
echo 15. Light yellow
echo.
echo 16. Bright white
echo.
echo 17. Go back
echo.
echo 18. Menu
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 set textColor=0&&goto backroundcolor
if %variable% equ 2 set textColor=1&&goto backroundcolor
if %variable% equ 3 set textColor=2&&goto backroundcolor
if %variable% equ 4 set textColor=3&&goto backroundcolor
if %variable% equ 5 set textColor=4&&goto backroundcolor
if %variable% equ 6 set textColor=5&&goto backroundcolor
if %variable% equ 7 set textColor=6&&goto backroundcolor
if %variable% equ 8 set textColor=7&&goto backroundcolor
if %variable% equ 9 set textColor=8&&goto backroundcolor
if %variable% equ 10 set textColor=9&&goto backroundcolor
if %variable% equ 11 set textColor=a&&goto backroundcolor
if %variable% equ 12 set textColor=b&&goto backroundcolor
if %variable% equ 13 set textColor=c&&goto backroundcolor
if %variable% equ 14 set textColor=d&&goto backroundcolor
if %variable% equ 15 set textColor=e&&goto backroundcolor
if %variable% equ 16 set textColor=f&&goto backroundcolor
if %variable% equ 17 goto settings
if %variable% equ 18 goto menu
if %variable% neq 1 goto textcolor

:backroundcolor
cls
echo Backroundcolor
echo.
echo 1. Black
echo.
echo 2. Blue
echo.
echo 3. Grean
echo.
echo 4. Aqua
echo.
echo 5. Red
echo.
echo 6. Purple
echo.
echo 7. Yellow
echo.
echo 8. White
echo.
echo 9. Gray
echo.
echo 10. Light blue
echo.
echo 11. Light grön
echo.
echo 12. Light aqua
echo.
echo 13. Light red
echo.
echo 14. Light purple
echo.
echo 15. Light yellow
echo.
echo 16. Bright white
echo.
echo 17. Backa
echo.
echo 18. Meny
echo.
set /p variable= Skriv numret av dit val:
if %variable% equ 1 set backroundColor=0&&goto menu
if %variable% equ 2 set backroundColor=1&&goto menu
if %variable% equ 3 set backroundColor=2&&goto menu
if %variable% equ 4 set backroundColor=3&&goto menu
if %variable% equ 5 set backroundColor=4&&goto menu
if %variable% equ 6 set backroundColor=5&&goto menu
if %variable% equ 7 set backroundColor=6&&goto menu
if %variable% equ 8 set backroundColor=7&&goto menu
if %variable% equ 9 set backroundColor=8&&goto menu
if %variable% equ 10 set backroundColor=9&&goto menu
if %variable% equ 11 set backroundColor=a&&goto menu
if %variable% equ 12 set backroundColor=b&&goto menu
if %variable% equ 13 set backroundColor=c&&goto menu
if %variable% equ 14 set backroundColor=d&&goto menu
if %variable% equ 15 set backroundColor=e&&goto menu
if %variable% equ 16 set backroundColor=f&&goto menu
if %variable% equ 17 goto textcolor
if %variable% equ 18 goto menu
if %variable% neq 1 goto backroundcolor

:start
set page=start
cls
echo hello.
echo.
echo 1. Save
echo.
set /p variable= Write the number of your choice:
if %variable% equ 1 goto save
if %variable% neq 1 goto start
it can save the page to a .dat file but how do i get it to work so that it also saves the color changes to the same .dat file

and how do i choose where the .dat file will be saved. i want it to be saved to a map
 
Windows Build/Version
22H2

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
And i made further suggestions which will help you.

Denis
 

My Computer My Computer

At a glance

Windows 11 Home x64 Version 25H2 Build 26200....
OS
Windows 11 Home x64 Version 25H2 Build 26200.8037

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
Years ago, I added Color to my own batch files and DOS Menus.
Installing Ansi.sys was the solution to my own problem.
I could not only add color, but special characters as well.

I'm sorry, that's probably not what you're talking about, but it was a lot of fun for me, at the time. 40 years ago.

Cheers Mate,
TM :cool:
 
Years ago, I added Color to my own batch files and DOS Menus.
Installing Ansi.sys was the solution to my own problem.
I could not only add color, but special characters as well.

I'm sorry, that's probably not what you're talking about, but it was a lot of fun for me, at the time. 40 years ago.

Cheers Mate,
TM :cool:
cant dowload any thing it is on a computer at work
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop
Code:
@echo off

SETLOCAL EnableDelayedExpansion
Cd %TMP%
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a"
)
echo Say the name of the colors, don't read
echo.

call :ColorText 0a "blue"
call :ColorText 0C "green"
call :ColorText 0b "red"
echo(
call :ColorText 19 "yellow"
call :ColorText 2F "black"
call :ColorText 4e "white"

echo.
echo.
echo.
pause >nul
goto :eof

:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof
 

My Computer My Computer

At a glance

Windows 11AMD Ryzen 7 5700GMicron Technology DDR4-3200 16GBNVIDIA GeForce RTX 3060
OS
Windows 11
Computer type
PC/Desktop
Manufacturer/Model
HP Pavilion
CPU
AMD Ryzen 7 5700G
Motherboard
Erica6
Memory
Micron Technology DDR4-3200 16GB
Graphics Card(s)
NVIDIA GeForce RTX 3060
Sound Card
Realtek ALC671
Monitor(s) Displays
Samsung SyncMaster U28E590
Screen Resolution
3840 x 2160
Hard Drives
SAMSUNG MZVLQ1T0HALB-000H1
Code:
@echo off

SETLOCAL EnableDelayedExpansion
Cd %TMP%
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
  set "DEL=%%a"
)
echo Say the name of the colors, don't read
echo.

call :ColorText 0a "blue"
call :ColorText 0C "green"
call :ColorText 0b "red"
echo(
call :ColorText 19 "yellow"
call :ColorText 2F "black"
call :ColorText 4e "white"

echo.
echo.
echo.
pause >nul
goto :eof

:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof
what do you want me to do with this
 

My Computer My Computer

At a glance

Windows 11
OS
Windows 11
Computer type
PC/Desktop

Latest Support Threads

Back
Top Bottom