Share via

Bat file

Anonymous
2021-10-19T08:10:34+00:00

I have a bat file

I am improving it bit by bit till I have reached

But not i have added a warning to it before a command

I now want to make that line font size Bigger than the others

How can I do that ??

So here is the Batch file content


@ECHO OFF

echo =====================================================================================  

echo Disk cleanup app  

Pause  

cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535  

echo =====================================================================================  

echo System File Checker  

Pause  

Sfc /scannow  

echo =====================================================================================  

echo Clean temporary files  

pause  

cd /d c:/  

rd %temp% /s /q  

echo =====================================================================================  

echo Deleting Bak,Old and Tmp   

pause  

del /s *.tmp & del /S *.bak & del /S *.old  

echo ===================================================================================== 
echo WARNING WARNING WARNING !!!!!!!!!  

echo Now this is Going to be a process, coming up is a large process if you continue 
echo see to that that you don't shutdown your Pc till I say so.  
echo If you agree to this then continue

echo If you do not like to continue Exit this app. 

echo Thank you for understanding.  

echo =====================================================================================  

echo Deployment Image Servicing and Management tool  

Pause  

DISM /Online /Cleanup-Image /RestoreHealth  

echo =====================================================================================  

echo Changing directory to C Drive  

Pause  

cd/d C:/Windows/System32  

echo =====================================================================================  

echo Cheking C disk  

Pause  

CHKDSK C: /f  

echo =====================================================================================  

echo Checking D disk  

pause  

CHKDSK D: /f  

echo =====================================================================================  

echo Clean RAM   

pause  

%windir%\system32\rundll32.exe advapi32.dll,ProcessIdleTasks  

echo =====================================================================================  

echo Defragment   

Pause  

defrag c:  

echo ===================================================================================== 
echo ===================================================================================== 

Echo Exit  

Pause  

Exit

Now Do you see the warning thing

I want it to be Big Font Sized

I don't think normal users can answer but I want to do that

You can actually try this file

But some things need admin

Windows for home | Windows 11 | Settings

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Martmcd 19,970 Reputation points Independent Advisor
    2021-10-19T12:39:02+00:00

    the command to change the colour is color bf (where b is the background and f is the foreground, the link I supplied will give more information on that

    color 40 will give a red background with black text
    color 0f is to change it back to black background with white text.

    colour 40 change colours
    echo Warning add warning lines
    set /P c=Do you want to continue[Y/N]? prompt (wait for response)
    colour 0f change colour back
    if /I "%c%" NEQ "Y" Exit deal with the response from user

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2021-10-19T11:35:18+00:00

    Yeah I will go to changing the color of the background instead of Changing the font size

    but if I use this

    set /P c=Do you want to continue[Y/N]? colour 0f if /I "%c%" NEQ "Y" Exit

    It asks whether to continue or not but it does not change the color of the background

    Is anything wrong with this Command

    I also tries this

    @echo offsetlocal:PROMPTSET /P AREYOUSURE=Are you sure (Y/[N])?IF /I "%AREYOUSURE%" NEQ "Y" GOTO ENDecho ... rest of file ...:ENDendlocal

    I want it to change the Color

    Please Edit the command and please give me <Sorry for that>

    I want it to change the color to white instead of black

    Was this answer helpful?

    0 comments No comments
  3. Martmcd 19,970 Reputation points Independent Advisor
    2021-10-19T10:54:46+00:00

    Hi Pranav.

    You cannot change the font of a single output line, the change will affect the whole terminal window.

    You could change the colours of the terminal window (eg red background) to draw attention to the warning.

    Color command

    https://docs.microsoft.com/en-us/windows-server...

    however, if the process is terminated at this point and the terminal window closed, it will remember the colour change and will display those colours next time the terminal is opened.

    I would suggest that you make it so that an input is required following the warning,

    so that if the user has the option to exit or continue

    eg

    set /P c=Do you want to continue[Y/N]?

    colour 0f

    if /I "%c%" NEQ "Y" Exit

    if the user presses Y, the colour will be set to white on black and the batch file will continue.

    if the user presses any other key, the colour will be reset and the batch file will exit.

    there are third party options that will apparently change the colour of specific text output

    such as these mentioned in this thread on Stackoverflow, which may be of interest.

    https://stackoverflow.com/questions/2048509/how...

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2021-10-19T08:48:48+00:00

    Do you mean it is impossible to increase the font size of certain lines

    Many websites tell things things I don't understand

    Was this answer helpful?

    0 comments No comments
  5. JX313 7,045 Reputation points
    2021-10-19T08:39:20+00:00

    I've tested a bunch of .bat files in my computer history, and according to my thoughts, since .bat files run in a CMD window, I think it's impossible.

    Was this answer helpful?

    0 comments No comments