Ex08-Windows-basic-commands-batchscript
To execute Windows basic commands and batch scripting
Navigate to any Windows environment installed on the system or installed inside a virtual environment like virtual box/vmware
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.
Execute the necessary commands/batch file for the desired output.
Create a directory named "my-folder"
mkdir %userprofile%\Desktop\MyLab
cd %userprofile%\Desktop\MyLab
type nul > MyFile.txt
dir %userprofile%\Desktop\MyLab
mkdir %userprofile%\Desktop\Backup
mkdir %userprofile%\Desktop\Backup
mkdir %userprofile%\Desktop\Documents
move MyLab Documents
List out all the associated file extensions
Compare the file hello.txt and rose.txt
Create a batch file named on the desktop. The batch file need to have a variable assigned with a desired name for ex. name="John" and display as "Hello, John".
@echo off
mkdir %userprofile%\Desktop\DocBackup
copy %userprofile%\Documents\*.docx %userprofile%\Desktop\DocBackup
echo Backup completed successfully!
@echo off
mkdir %userprofile%\Desktop\DocBackup
copy %userprofile%\Documents\*.docx %userprofile%\Desktop\DocBackup
del %userprofile%\Documents\*.docx
echo Backup and deletion completed successfully!
The commands/batch files are executed successfully.