FANDOM


Description: Edit

A list of things to do regarding batch scripts. See "Command Prompt" for a list of CMD tricks you can include in batch files.

To Start: Edit

1. Create a .bat file - Right click on desktop and create a wordpad document with the ext of ".bat".

Different commands to use:

TITLE - The Window name for the BAT file.

ECHO - the “print” statement for BAT files. Anything following the word ECHO will be displayed in the command prompt as text, on its own line.

ECHO OFF – BAT writers typically put this at the beginning of their files. It means that the program won’t show the command that you told it to run while it’s running – it’ll just run the command. I’d recommend that after you run this test program, you try removing this line from your code to see what happens.

PAUSE - This outputs the “press any key to continue…” message that you’ve seen all too many times. It’s helpful because it pauses the BAT file execution until the user tells it to go again. If you don’t put this in your program, everything will speed by and end before you can see it. People typically put this in BAT files to give the user a chance to review the material on the screen before continuing.

CLS - Clears the DOS window.

Windows run commands will be the most used in batch files. Ex: Ipconfig /all, chkdsk, msinfo32, ping, tracert, and dir.

2. Think about what you want it to do and edit your bat file to do it. Right click your BAT file and click “edit” to bring up Notepad. The whole document should be blank. Here is an example: (::TEXT is a comment and not a command)

ECHO OFF

::CMD will no longer show us what command it’s executing(cleaner)

ECHO As a network admin, I’m getting tired of having to type these commands in! Hopefully, this saves me some time in the long run. 

:: Print some text

IPCONFIG /ALL 

:: Outputs tons of network information into the command prompt

PAUSE 

:: Lets the user read the important network information

PING www.google.com 

:: Ping google to figure out if we’ve got internet!

ECHO All done pinging Google. 

::Print some text

PAUSE 

:: Give the user some time to see the results. Because this is our last line, the program will exit and the command window will close once this line finishes.

Here Are Some I've Used: Edit

To Get Basic Computer Information: Edit

Echo Off

title infotool

mkdir c:\ittech

cd c:\ittech

wmic bios get serialnumber >serial.txt

ipconfig /all >info.txt

echo ------------------------------------------------------- >>info.txt

echo ------------------------------------------------------- >>info.txt

echo ------------------------------------------------------- >>info.txt

ping 8.8.8.8 >>info.txt

echo ------------------------------------------------------- >>info.txt

echo ------------------------------------------------------- >>info.txt

echo ------------------------------------------------------- >>info.txt

systeminfo | Find "Time" >>info.txt

echo ------------------------------------------------------- >>info.txt

echo ------------------------------------------------------- >>info.txt

echo ------------------------------------------------------- >>info.txt

systeminfo >>info.txt

Echo Done!

===
To Make A Matrix Batch File: === save this file as "Matrix.bat" or *.bat. 


@echo off

color 02

:tricks

echo %random%%random%%random%%random%%random%%random%%random%%random%

goto tricks


Make Your Keyboard Type (Any) Message Continuously Edit

This VBS trick can make any of your friend's keyboard type any message continuously. Open Notepad, copy the code given below and save the file as Tricks.vbs or *.vbs. You will need to restart your computer to stop this. Try this after closing all important programs.


Set wshShell = wscript.CreateObject("WScript.Shell")

do

wscript.sleep 100

wshshell.sendkeys "This is a Virus. You have been infected."

loop


Bloated Folders Delete (For Viruses): Edit

DEL /F /Q /S "C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\*.*"

for /D %%i in ("C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\*") do RD /S /Q "%%i"


To Add A Local Administrator Profile: Edit

net user (usernameSPACEpassword) /add

net localgroup administrators (usernameSPACE)/add


NOTE: I am still working on how to get the "password to never expire" and the "User cannot change password" boxes checked. 



To Clear Printer Files: Edit

net stop spooler

del %systemroot%\system32\spool\printers\*.shd

del %systemroot%\system32\spool\printers\*.spl

net start spooler


To Find Out A Host Machines Name (Run On A Virtual Machine): Edit

This only works if you are using "VirtualPC" or "HyperV"


@echo off

set query=reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters\" /v "PhysicalHostNameFullyQualified"

(for /f "tokens=3" %%N in ('%query% ^|find "PhysicalHostNameFullyQualified"') do call set "name=%%N")1>nul 2>nul

REM

if "%NAME%"=="" (echo Not a Virtual machine) else (echo Physical Host name: %NAME%)

:: END

pause

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.