Bat File

Add Code

Double-click this New Text Document to open your default text editor. Copy and paste the following code into your text entry.

------------------@echo offtitle This is your first batch script!echo Welcome to batch scripting!pause ----------------

batch to copy from network drive to C: or D: drive

----------------echo offclscopy "\\192.168.80.85\sh\*" D:\bk                    -----OR-------------echo offclsecho Would you like to do a backup?pausecopy "\\192.168.80.85\sh\*" D:\bkpause

 Restart a Windows service from a script?
net stop "myservice"net start "myservice"        ORnet stop "myservice" && net start "myservice" 

create a batch file, and put this code in it after the @echo off line:

@echo offshutdown -s -t 1800

The computer will shut down 30 minutes (1800 seconds) after running the batch file.

To cancel a shutdown initiated by that batch file, you can go to StartRun and type:

shutdown -a


shut down after 1 hour 

shutdown -s -t 3600


Program Launcher

---------------------------------@echo offcd "C:\Program Files\Microsoft Office\root\Office16\"start EXCEL.EXE ---------------------------------------

Delete Temporary Files 

Press the Windows key + S simultaneously. Type “cmd” or “command prompt” and select Run as administrator.

Type or paste the command del /q/f/s %TEMP%\ into the dialogue and press Enter.
del /q/f/s %TEMP%\del /q/f/s %TEMP%\* 


del %TEMP%\*.* /f /s /q




1. Open Notepad and type in the following:
rd %temp% /s /q
md %temp%
2. Now, save the file exactly as the path below:
%appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat

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

@ECHO OFFdel /s /f /q %userprofile%\Recent\*.*del /s /f /q C:\Windows\Prefetch\*.*del /s /f /q C:\Windows\Temp\*.*del /s /f /q %USERPROFILE%\appdata\local\temp\*.*------
/Below command to Show the folder after deleted filesExplorer %userprofile%\RecentExplorer C:\Windows\PrefetchExplorer C:\Windows\TempExplorer %USERPROFILE%\appdata\local\temp


Clean up temp directory automatically in Windows 10 

@echo off del "%tmp%\*.*" /s /q /f FOR /d %%p IN ("%tmp%\*.*") DO rmdir "%%p" /s /q

Create Batch File to Delete Temp Files

---------

@echo offdel /s /f /q c:\windows\temp\*.*rd /s /q c:\windows\tempmd c:\windows\tempdel /s /f /q C:\WINDOWS\Prefetchdel /s /f /q %temp%\*.*rd /s /q %temp%md %temp%deltree /y c:\windows\tempor~1deltree /y c:\windows\tempdeltree /y c:\windows\tmpdeltree /y c:\windows\ff*.tmpdeltree /y c:\windows\historydeltree /y c:\windows\cookiesdeltree /y c:\windows\recentdeltree /y c:\windows\spool\printersdel c:\WIN386.SWPcls

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



Open Multiple Programs in Windows at Once

@echo off start “Chrome” “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe”start “Outlook” “C:\Program Files\Microsoft Office\Office12\Outlook.exe”start “Foxpro” “C:\Program Files\Microsoft Visual FoxPro 9\vfp9.exe