Skip to content

SUJITH-03/Windows-basic-commands-batchscript

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ex08-Windows-basic-commands-batchscript

AIM:

To execute Windows basic commands and batch scripting

DESIGN STEPS:

Step 1:

Navigate to any Windows environment installed on the system or installed inside a virtual environment like virtual box/vmware

Step 2:

Write the Windows commands / batch file Save each script in a file with a .bat extension. Ensure you have the necessary permissions to perform the operations. Adapt paths as needed based on your system configuration.

Step 3:

Execute the necessary commands/batch file for the desired output.

WINDOWS COMMANDS:

Exercise 1: Basic Directory and File Operations

Create a directory named "MyLab" on the desktop.

COMMAND AND OUTPUT

mkdir %userprofile%\Desktop\MyLab

1_mkdir

Change to the "MyLab" directory and create an empty text file named "MyFile.txt" inside it.

COMMAND AND OUTPUT

cd %userprofile%\Desktop\MyLab

2_cd

type nul > MyFile.txt

3_myfile

List the contents of the "MyLab" directory.

COMMAND AND OUTPUT

dir %userprofile%\Desktop\MyLab

4_dir

Copy "MyFile.txt" to a new folder named "Backup" on the desktop.

COMMAND AND OUTPUT

mkdir %userprofile%\Desktop\Backup

5_backup

copy MyFile.txt %userprofile%\Desktop\Backup

6_copy

Move the "MyLab" directory to the "Documents" folder.

COMMAND AND OUTPUT

mkdir %userprofile%\Desktop\Documents

move MyLab Documents

9_modified batch1

Exercise 2: Advanced Batch Scripting

Create a batch script named "BackupScript.bat" that creates a backup of files with the ".docx" extension from the "Documents" folder to a new folder named "DocBackup" on the desktop.

COMMAND

@echo off
mkdir %userprofile%\Desktop\DocBackup
copy %userprofile%\Documents\*.docx %userprofile%\Desktop\DocBackup
echo Backup completed successfully!

OUTPUT

10_batch1

COMMAND

  @echo off
  mkdir %userprofile%\Desktop\DocBackup
  copy %userprofile%\Documents\*.docx %userprofile%\Desktop\DocBackup
  del %userprofile%\Documents\*.docx
  echo Backup and deletion completed successfully!

OUTPUT

11_modified batch1

RESULT:

The commands/batch files are executed successfully.

About

Ex08-Windows-basic-commands-batchscript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Batchfile 100.0%