Reputation: 593
I made an interactive batch file that allows you to message people and im having problems with changing the color PERMANENTLY for a specific profile within the batch. (It can make a profile for the batch file to use as a login.) So need to know if there is a way to change a batch file and save it for that particular user so that when they log in, the color changes back to their chosen color.
The messenger saves its users info in hidden .txt
files which can be compared with the users input when logging in by using the for /f
command after it unhides the txt file being read. So now I need it to basically build a batch file with the saved info for the user to change the color on all screens for only that particular user.
If you haven't already gathered, it can have multiple users.
Here's what I have for it so far.
:COLORCHANGER
cls
echo.
echo.
echo Background Text
echo 0=Black A=Bright Green
echo 1=Deep Blue B=Bright Blue
echo 2=Dark Green C=Light Red
echo 3=Blue D=Light Purple
echo 4=Dark Red E=Light Yellow
echo 5=Purple F=Bright White
echo 6=Dark Yellow
echo 7=White
echo 8=Grey
echo 9=Deep Blue
set color=
set /p color=Color:
[make a .bat
file for that particular user so that when they log in it changes to their desired color for all screens in the .bat
file]
Upvotes: 0
Views: 8549
Reputation: 3900
You can use these lines of code...
set /p col=Color code:
echo color %col% > "color.bat"
That will make a .bat file with the code "color [user_input]"
Now, when you start the main program, put the code call color.bat
and it will set the color to whatever is in the file.
In addition, you can hide the file after creating by using this snippet attrib +h color.bat
Hope it helps.
Upvotes: 2