ECHO: To display text on the screen
@ECHO OFF: To hide text
START: To run the default application file
REM: To input comments in the program
MKDIR: To create a directory
RMDIR: To delete directories
DEL: To delete files
COPY: To copy one or more files
XCOPY: For copying files with additional options
FOR / IN / DO: For specifying files
TITLE: For editing window titles
Some interesting tricks with batch files
Magic Trick 1: The Matrix Marvel
Still reminiscing about the Matrix movie? With this batch file, you can jazz up your background akin to the iconic Matrix screen.
To conjure this green screen magic using a batch file, follow these steps below:
Step 1: Open a Text Document and rename it to matrix.bat. As soon as the file extension changes to .bat, its icon metamorphoses into a sawtooth.
Step 2: Time to Customize Your File for Programming. To Do This, Right-click on the File and Select Edit.
On the Notepad Display Screen, Your Task is to Paste the Following Lines into Notepad:
@echo off
color 2
:start
echo %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random% %random%
goto start
Click Save to save the file and double-click on it to open the Matrix effect screen.
Step 1: Open a Notepad file.
Step 2: Copy and paste the following code snippet into the Notepad file:
cls
@ECHO OFF
The Cybernetic Saboteur: Unleashing Chaos
Unlock the Vault: Access Control Panel
Concealed in Shadows: Forge the Hidden Path
Initiate Protocol: Confirmation Required
echo Would you like to lock this folder? (Y/N)
set/p 'response=>'
if %response%==Y goto LOCK
if %response%==y goto LOCK
if %response%==n goto END
if %response%==N goto END
echo That's not a valid option.
goto CONFIRMATION
:SECURE
rename Hidden 'Protected.{21EC2020-3AEA-1069-A2DD-08002B30309D}'
attrib +h +s 'Protected.{21EC2020-3AEA-1069-A2DD-08002B30309D}'
echo Folder secured
goto EndProcess
:UNLOCKED
echo Please input password to unlock your secured folder
set/p 'password=>'
if NOT %password%== 1234 goto FAILED
goto UNLOCK_ATTEMPT
:UNLOCK_ATTEMPT
CLS
echo Please enter the password to unlock your secure folder
set/p 'password=>'
if NOT %password%== 1234 goto FAILURE
attrib -h -s 'Protected.{21EC2020-3AEA-1069-A2DD-08002B30309D}'
rename 'Protected.{21EC2020-3AEA-1069-A2DD-08002B30309D}' Unhidden
echo Folder successfully unlocked
goto EndProcess
:FAILED
@echo off
color 02
echo Warning: Virus Detected - Complete hard drive corruption imminent
timeout /t 5 /nobreak >nul
set count=0
:trickery
if %count% == 200 goto shutdown
echo %random%%random%%random%%random%%random%%random%%random%%random%
set /a count=%count%+1
goto trickery
:poweroff
cls
:shutdown
shutdown -s -t 45 /c 'You have attempted to access unauthorized files. Farewell.'
echo Please enter password to initiate abort sequence
set/p 'password=>'
if NOT %password%== 1234 goto shutdown
echo Abort Initiated
goto AbortProcess
:AbortSequence
C:WindowsSystem32shutdown.exe -a
Abort Successful
timeout /t 3 /nobreak >nul
CLS
goto unlock_sequence
goto finish
:CreateHiddenDir
mkdir Hidden
echo Hidden folder created successfully
Step 3: Set Password
The default password is 1234. However, you can also change this password. To change the password, locate the following line of code:
if NOT %password%== 1234 goto
Replace 1234 with the password you desire. Finally, save the file with the extension .bat.
When you open the file for the first time, it will blink and display another file named Hidden. To hide this file, simply click on the original file once again and it will ask if you want to hide the file. If you enter Y, the file will be hidden, but if you enter N, nothing will change.
After hiding the file and when you want to access it later, you will need to click on the original file once again and it will prompt you to enter the password.
However, it's important to remember that users with limited knowledge or experience with computer systems and batch files may not be easily deceived by this method.
Trick 3: Color Sampler
Understanding Batch Files on Windows OS
If you want to test colors using a batch file on Windows, below is the code you need.
Open a Notepad file, then copy and paste the code below into it:
Turn off the lights
Begin the experiment
Assist with coloring
Display a virtual barrier
Let there be silence
Input a color code to test the palette
Exit by pressing the X key
Prompt for color selection
Apply the selected color
Proceed to the test section
Finally, save the file as a .bat file format
In Windows, there are various types of files, such as Conhost.exe, rundll32.exe, or MOM.exe, each with its own specific tasks. To learn more about them, you can refer to articles on:
- Conhost.exe
- rundll32.exe
- MOM.exe
Here, Mytour has provided you with all the information you need to explore Batch files on the Windows operating system, what Batch files are, and some interesting tricks with Batch files. Hopefully, after reading this article, you will have gained more knowledge about files on the Windows operating system.
