1

Is there any way that you can change CMD into the colour FF? I am trying to hide a password when typed into a .bat file.

Current Batch File:

@echo off
cls
color 7F

set /P pcname=Enter PC Name: \\

set /P auser=Enter Admin Username: DOMAIN\
echo Please Press Enter, then type your password. (Your Password will be Blank)
pause
color FF
set /P apass=Enter Admin Password: 
cls
color 07
\\fs\scripts\remote \\%pcname% -u DOMAIN\%auser% -p %apass% "\\fs2\installs$\Office\2. Proxy On.cmd"
\\fs\scripts\remote \\%pcname% -u DOMAIN\%auser% -p %apass% ipconfig /flushdns
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
SET Choice=
SET /P Choice=IPFire is Now Configured with %pcname% and DNS has been Flushed
  • I don't think so. Perhaps if you use some 3.part software like this http://www.codeproject.com/Articles/17033/Add-Colors-to-Batch-Files – MadsTheMan Feb 02 '16 at 12:04
  • 3
    Even if you could change the color, it's a bad solution. Better use some way to [input hidden text](http://stackoverflow.com/a/22282223/463115) – jeb Feb 02 '16 at 12:14
  • If you check the ERRORLEVEL you will see that setting color to 00 or ff generates an error. – RGuggisberg Feb 02 '16 at 12:32
  • You can also [borrow from PowerShell](http://stackoverflow.com/a/29216039/1683264) to hide password entry. – rojo Feb 02 '16 at 12:34
  • 1
    check [this](http://stackoverflow.com/a/24396149/388389) and [this](http://stackoverflow.com/a/24273024/388389) – npocmaka Feb 02 '16 at 12:40

1 Answers1

0

Even if you could change the color, it's a bad solution. Better use some way to input hidden text – jeb 10 hours ago

Thanks Jeb, I managed to implement the script from here

Community
  • 1
  • 1