/build/static/layout/Breadcrumb_cap_w.png

Writing Cool Batch Files to Grab your Eye

Most of the time IT folks don't spend enough time exercising eye candy in batch files or we just rush to get the basic common task done.

Basically here is what I do to grab the users eye's. Copy text into a text file and save it as "hello.bat" yes with quotes.

 

title Saying Hello < -- Setting Title of Command Prompted Window
color 0a <-- Sets Green Text with Black Background
mode con:cols=100 lines=20 <-- Sets Window Size
@ ECHO OFF <-- Echo's the information off
cls <-- clears above text
echo . Saying Hello. <-- Echo Words
echo . <-- Echo Words
echo . Just Saying Hi! <-- Echo Words
pause <-- Pauses Window

 

Everything is green can be deleted once pasted into a hello.bat file.

I love using the built in commands to change colors and grab attention of users try it out and see what you can create.

Oh I wanted to add something here for those K1 Administrators.

Kace already has some information on how to backup your database using some of there scripts so I wanted to add something to that.

@echo off
cls
set scrptloc=M:\example direcoty
set bkuploc=M:\example directory

REM directory of your backups

if "%1%"=="" goto usage

cd /D %1

for /F "usebackq tokens=1-3 delims=./- " %%p in (`date /t`) do mkdir %%r%%q%%p
for /F "usebackq tokens=1-3 delims=./- " %%p in (`date /t`) do cd %%r%%q%%p
echo.
echo backing up to %bkuploc%
"%systemroot%\system32\ftp.exe" -s:"%scrptloc%\backup.scr"

goto end

:usage
echo usage:
echo    %bkuploc%

:end
cd "%scrptloc%"
@echo on

With the use of for /f you basically create directorys using a 0212Tue date as folder name then using this script I delete only but two backups in that folder thats setup using tasks on the server that you storing the data.

forfiles /p K1000_Backups_directory /m * /d -2 /c "cmd /c rmdir /S /Q @path"

 

Cheerio.

 


 


Comments

This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ