0% found this document useful (0 votes)
13 views

Lab 2

Its all about my lab 2 work in detail

Uploaded by

Zurghuna Gul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lab 2

Its all about my lab 2 work in detail

Uploaded by

Zurghuna Gul
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

ABBOTTABAD UNIVERSITY OF SCIENCE AND TECHNOLOGY

DEPARTMENT OF COMPUTER SCIENCE

NAME : ZURGHUNA GUL

ROLL NO : 13646

SUBMITTED TO :SIR IMRAN

SUBMISSION DATE : 14TH OCT 24

LAB : 2

SUBJECT : OPERATING SYSTEM


INTRODUCTION TO BASIC SHELL

INTRODUCTION

LABEL COMMAND

The label command in an operating system is typically used to assign or change the volume label
of a disk or a partition. A volume label is a human-readable name that helps users identify the
disk or partition easily. This command is available in various operating systems, such as
Windows and Unix/Linux.

The label command serves several useful purposes in operating systems. Here are some key uses:

1. Identification: It provides a human-readable name for disks or partitions, making it easier


for users to identify their content without needing to delve into the directory structure.
2. Organization: In systems with multiple drives or partitions, labels help organize data,
allowing users to quickly locate specific volumes (e.g., "Photos", "Backups", "Projects").

EXAMPLE

 The command format is usually LABEL [drive:] [label].


 For example, LABEL D: MyData assigns the label "MyData" to the D: drive.
MD COMMAND

INTRODUCTION

he MD command, short for "Make Directory," is a command-line instruction used in various


operating systems to create new directories (or folders) within a file system. It's commonly found
in Windows, DOS, and some Unix/Linux shells, though the equivalent command in Unix/Linux
is often mkdir.

Syntax:

 In Windows/DOS: MD [directory_name]
 Example: MD Projects creates a directory named "Projects."
The MD (Make Directory) command is a fundamental command used in command-line
interfaces for various purposes. Here are some of its primary uses:

1. Creating Directories: The primary use is to create new directories (folders) for organizing
files. This helps maintain a structured file system.
2. Organizing Projects: Users can create project-specific directories to separate files related
to different tasks, such as "Projects," "Reports," or "Resources."

EXAMPLE

Create a Single Directory:

MD newproject
MKDIR COMMAND

INTRODUCTION

The mkdir command, short for "make directory," is a command-line utility used in various
operating systems, including Unix, Linux, and Windows, to create new directories (or folders)
within a file system. It plays a crucial role in organizing files and managing directory structures.

EXAMPE

mkdir -p Projects/2024/Reports

USES

The mkdir command is widely used in command-line environments for several purposes. Here
are some of its primary uses:
1. Creating Directories: The primary function of mkdir is to create new directories (or
folders), helping users organize files in a structured manner.
2. Organizing Projects: Users can create project-specific directories to separate files related
to different tasks, such as "Projects," "Reports," and "Data."
3. Batch Processing: In scripts and automation, mkdir can be used to create multiple
directories at once, streamlining processes like software installation or backup setups.

Mklink command

INTRODUCTION

The MKLINK command is a Windows command-line utility used to create symbolic links, hard
links, and directory junctions. These links serve as pointers to files or directories, allowing users
to access them from different locations without duplicating data.

EXAMPLE

MKLINK LinkToHardFile.txt C:\Path\To\OriginalFile.txt

he MKLINK command in Windows serves several important purposes related to file and
directory management. Here are some key uses:

1. Creating Shortcuts to Files and Directories

 Symbolic Links: Allows users to create shortcuts that point to files or directories located
elsewhere on the system, making it easier to access frequently used items without
navigating through multiple directories.
 Example: Creating a symbolic link for a document you frequently use, allowing you to
access it from a different location.

MODE COMMAND

INTRODUCTION

The MODE command is a command-line utility in DOS and Windows that is primarily used to
configure and manage devices, particularly serial ports and display settings. It provides options
to change the properties of connected devices, such as the baud rate for serial communication or
the display settings for the console.

EXAMPLE

MODE COM1: BAUD=9600 PARITY=N DATA=8 STOP=1

USE

The MODE command has several important uses, particularly in DOS and Windows
environments. Here are some key applications:

1. Configuring Serial Ports

 The MODE command is primarily used to set the parameters for serial ports (COM
ports). This includes:
o Baud Rate: Speed of data transmission (e.g., 9600, 115200).
o Data Bits: Number of data bits in each transmission (commonly 7 or 8).
o Parity: Error-checking mechanism (None, Even, Odd).
o Stop Bits: Number of stop bits (1 or 2).

MOVE COMMAND

INTRODUCTION

The MORE command is a command-line utility available in DOS, Windows, and Unix/Linux
systems that allows users to view text files or output from other commands one screen at a time.
This is particularly useful for reading large files or command outputs that exceed the screen's
display capacity.

EXAMPLE

MORE myfile.txt

USE
The MORE command is useful for several purposes in command-line environments. Here are
some key uses:

1. Viewing Long Text Files

 Paginate Content: It allows users to read long text files one screen at a time, preventing
information overload and making it easier to digest large amounts of data.

PATH COMMAND

INTRODUCTION

The PATH command in Windows and DOS is used to display or set the search path for
executable files. The search path is a list of directories that the operating system checks when a
command is entered in the command prompt. If the executable file for a command is not located
in the current directory, the system searches through the directories listed in the PATH
environment variable.

EXAMPLE

SET PATH=%PATH%;C:\MyPrograms

The PATH command is essential for managing how executables are accessed in command-line
environments. Here are some key uses of the PATH command:

1. Executing Programs Easily

 The primary purpose of the PATH command is to specify directories that the operating
system searches for executable files. By adding directories to the PATH, you can run
programs without needing to specify their full paths.

2. Improving Command-Line Efficiency


 With a properly set PATH, you can quickly execute commands and scripts from any
location in the command prompt, enhancing productivity.

PAUSE COMMAND

INTRODUCTION

he PAUSE command is a simple command-line utility in Windows (and DOS) that temporarily
halts the execution of a batch file or command prompt session until the user presses a key. It is
particularly useful for allowing users to read messages or outputs before the window closes or
the script continues executing.

Use

The PAUSE command is primarily used in batch files and command-line scripts for several key
purposes:

1. Halting Execution Temporarily

 The command pauses the execution of a script or batch file, allowing users to stop and
review information displayed on the screen before continuing.

2. User Interaction
 It prompts users to press any key to proceed, facilitating user engagement and ensuring
they have acknowledged important messages or output.

3. Debugging Scripts

 When developing or debugging batch files, inserting PAUSE can help identify issues by
allowing users to see the output or error messages before the window closes

Example

Example 1: Basic Use of PAUSE

batch
Copy code
@echo off
echo This script will perform a series of tasks.
PAUSE
echo Task 1 completed.
PAUSE
echo Task 2 completed.

PRINT COMMAND

INTRODUCTION
The POPD command is a command-line utility used in DOS and Windows command-line
environments that allows users to change the current directory back to the directory stored in a
directory stack. It works in conjunction with the PUSHD command, which saves the current
directory onto a stack and then changes to a new directory.

EXAMPLE

PUSHD C:\FolderA

REM Do some operations in FolderA

PUSHD C:\FolderB

REM Do some operations in FolderB

POPD # This will return to FolderA

The POPD command is useful for several purposes in command-line environments, especially
when navigating between directories. Here are the key uses of the POPD command:

1. Returning to Previous Directories

 The primary use of POPD is to quickly return to the last directory saved in the stack by
the PUSHD command. This is particularly useful when you need to switch back and forth
between directories frequently.

2. Simplifying Directory Navigation

 When working in complex directory structures, POPD allows users to navigate back
without needing to remember or retype the full path of the previous directory, making it
easier to manage file operations.
PRINT COMMAND

INTRODUCTION

he PRINT command is a command-line utility available in DOS and Windows environments that
is used to print text files to a printer. It allows users to send files directly to a printer from the
command line without needing to open them in a text editor.

USE

The PRINT command has several practical uses in command-line environments, particularly for
managing printing tasks efficiently. Here are some key uses:

1. Direct Printing of Text Files

 The primary use of the PRINT command is to send plain text files directly to a printer
without opening them in an editor. This allows for quick printing of documents.
2. Batch Printing

 In scripts or batch files, the PRINT command can be used to automate the printing of
multiple text files. This is useful for users who need to print reports or logs without
manual intervention.

EXAMPLE

PRINT example.txt

PROMPT COMMAND

INTRODUCTION

The PROMPT command is a command-line utility in DOS and Windows environments that
allows users to customize the appearance of the command prompt. It changes the text displayed
in the command prompt, enabling users to modify the prompt to include various pieces of
information or to personalize their command-line experience.

USE

The PROMPT command is used for several practical purposes in command-line environments.
Here are the key uses:

1. Customizing Command Prompt Appearance


 Users can modify the appearance of the command prompt to include specific information,
such as the current directory, time, or date, enhancing the context of the command-line
interface.

2. Improving Usability

 By customizing the prompt, users can make their command-line experience more user-
friendly. For instance, displaying the current directory can help prevent confusion when
working in multiple folders.

EXAMPLE

PROMPT $D $T $P$G

PUSHD COMMAND
INTRODUCTION

The pushd command is a useful shell command primarily used in Unix-like operating systems
(like Linux and macOS) and in Windows command line environments. It allows you to change
the current directory while also saving the previous directory on a stack. This is particularly
helpful for navigating between multiple directories without losing track of where you came from.

EXAMpwd

# Output: /home/userPLE

pushd projects

USE

The pushd command is primarily used for efficient directory navigation in command-line
interfaces. Here are some key uses and benefits:

Key Uses of pushd

1. Quick Directory Changes:


o Allows you to switch to a new directory while saving your current location,
enabling you to easily return later.
2. Stack Management:
o Maintains a stack of directories, letting you navigate back through your directory
history without needing to retype paths.
RD COMMAND

INTRODUCTION

The rd command, short for "remove directory," is a command-line utility used to delete
directories in various operating systems, including Windows and DOS. It allows users to remove
empty directories or directories that contain files and subdirectories (with additional options).

EXAMPLE

rd MyFolder

USE

The rd command, also known as rmdir, is used for removing directories in command-line
environments, primarily in Windows and DOS. Here are some key uses of the rd command:

Key Uses of rd Command

1. Delete Empty Directories:


o The primary use of the rd command is to remove empty directories. This is useful
for cleaning up your file system.

RECOVER COMMAND

INTRODUCTION
he recover command is a utility found in DOS and Windows that is used to recover readable
information from a damaged or corrupted disk. It is particularly useful for retrieving files from
floppy disks, hard drives, or other storage media that may have been affected by file system
errors or physical damage.

EXAMPLE

recover A:\report.txt

USE

The recover command is primarily used to attempt the recovery of lost or corrupted files from
damaged disks or storage media. Here are the main uses of the recover command:

Key Uses of the recover Command

1. Recovering Lost Files:


o The command is specifically designed to retrieve files that may have become
corrupted due to disk errors, accidental deletions, or incomplete writes.
2. Dealing with Damaged Media:
o It's particularly useful for recovering data from floppy disks, but it can also be
applied to other storage devices like hard drives that may have sectors marked as
bad.

REM COMMAND

INTRODUCTION
The rem command, short for "remark," is a command used in batch files and scripts in
DOS and Windows environments to add comments. These comments are not executed as
commands; instead, they serve as annotations or explanations for anyone reading the
code.

FEATURES

1. Commenting Code: The primary use of rem is to add comments within batch files or
scripts to explain what the code does, which helps in understanding and maintaining the
script.
2. Ignored by the Interpreter: Any text following the rem command on that line is ignored
by the command interpreter, meaning it does not affect the execution of the script.
3. Multi-Line Comments: You can use rem on multiple lines to document your code
thoroughly.
4. Alternative Method: In batch files, you can also use the :: (double colon) syntax to
comment lines, but be cautious as it can sometimes lead to unexpected behavior.
RENAME COMMAND

INTRODUCTION

The rename command, also known as ren, is a command-line utility used in DOS and Windows
operating systems to change the name of files or directories. It allows users to modify the names
of one or more files without needing to open them or use a graphical interface.

Basic Syntax

rename [oldname] [newname]

USE

Key Uses of the rename Command


1. Renaming a Single File:
o You can rename a specific file by providing its current name and the new name
you want to assign.

EXAMPLE

rename oldfile.txt newfile.txt

ROBOCOPY COMMAND

INTRODUCTION

The robocopy (Robust File Copy) command is a powerful file and directory replication tool in
Windows. It is designed to copy large amounts of data and is particularly useful for backups,
mirroring, and transferring files over the network. Unlike the basic copy or xcopy commands,
robocopy offers a variety of features and options that enhance its capabilities.

KEY FEATURES

 RESILIENCE: robocopy can resume interrupted file transfers, making it ideal for unreliable
network connections.
 MULTITHREADING: It supports multithreaded copying, allowing multiple files to be
copied simultaneously, which can significantly speed up the transfer process.
 FILE AND DIRECTORY MIRRORING: You can mirror entire directories, ensuring that
the destination matches the source, including deleting files that no longer exist in the source.
 SELECTIVE COPYING: It allows you to copy files based on attributes, timestamps, and
even exclude specific files or directories.
 DETAILED LOGGING: robocopy can produce detailed logs of the copying process, which
is helpful for troubleshooting and auditing.

EXAMPLE

robocopy C:\SourceFolder D:\DestinationFolder /MIR


SET COMMAND

INTRODUCTION

The SET command is a fundamental instruction used in various programming languages,


database management systems, and shell scripting. It serves primarily to assign values to
variables or configure settings.

USE

The SET command is used to initialize or change the value of a variable in many programming
languages and environments.

In SQL, the SET command is typically used to assign a value to a variable or to update fields in a
table.

EXAMPLE

SET @total_sales = (SELECT SUM(amount) FROM sales);

UPDATE employees SET salary = salary * 1.1 WHERE department = 'Sales';


SETLOCAL COMMAND

INTRODUCTION

Introduction to the SETLOCAL Command

The SETLOCAL command is primarily used in Windows batch scripting. It helps manage
environment variables within a script by creating a local scope for those variables. This means
that any changes made to environment variables after invoking SETLOCAL will not affect the
global environment after the script ends.

USE

The SETLOCAL command is used in Windows batch scripting to create a local scope for
environment variables, ensuring that changes made to those variables do not affect the global
environment. Here are some common uses and scenarios where SETLOCAL is beneficial:
1. Preventing Global Variable Changes

When you want to modify environment variables without affecting their global values,
SETLOCAL is essential.

EXAMPLE

@echo off

SETLOCAL

set MYVAR=Hello

echo Inside SETLOCAL: %MYVAR%

ENDLOCAL

echo Outside SETLOCAL: %MYVAR% REM This will be empty

SCHTASKS COMMAND
INTRODUCTION

SCHTASKS is a command-line utility in Windows that allows users to create, delete, configure,
or display scheduled tasks on a local or remote computer. It provides a powerful way to automate
various tasks, such as running scripts, launching applications, or performing system
maintenance, at specified times or in response to specific events.

USE

The SCHTASKS command is used for managing scheduled tasks in Windows. Here are some
common uses and scenarios for SCHTASKS, along with examples:

Common Uses of SCHTASKS

1. Creating Scheduled Tasks


o Automate tasks by scheduling scripts, applications, or commands to run at
specific times or intervals.

EXAMPLE

SCHTASKS /Create /TN "BackupTask" /TR "C:\Backup\backup.bat" /SC DAILY /ST 02:00
SHIFT COMMAND

NTRODUCTION
I

The SHIFT command is a built-in command in Windows batch scripting that is used to change
the position of command line parameters within a batch file. It allows you to access additional
command line arguments more easily, particularly when dealing with scripts that require
multiple parameters.

USE

1. Parameter Manipulation:
o The SHIFT command shifts the command line arguments to the left, meaning that
%1 becomes %2, %2 becomes %3, and so on. The first argument is effectively
removed, allowing you to process subsequent arguments.
2. Dynamic Handling:
o It is particularly useful in loops or scripts where the number of parameters is not
fixed, enabling more dynamic and flexible handling of input.
3. Usage in Scripts:
o Typically used in conjunction with loops to process multiple parameters
sequentially.

EXAMPLE

@echo off

setlocal

rem Check if at least one parameter is provided

if "%1"=="" (

echo No parameters provided.

exit /b

echo Initial parameters:

echo %1 %2 %3 %4 %5

rem Loop through the parameters

:loop
if "%1"=="" (

goto end

echo Processing: %1

SHIFT

goto loop

:end

echo All parameters processed.

=
SHUTDOWN COMMAND

INTRODUCTION

The SHUTDOWN command is a built-in command in Windows that allows users to shut down,
restart, or log off a computer from the command line. This command is particularly useful for
system administrators and users who want to automate system management tasks or perform
remote shutdowns.

Key Features

1. Shutdown Options:
o You can perform different actions, including shutting down, restarting, or logging
off a user session.
2. Timer Functionality:
o The command allows you to set a timer for the shutdown operation, providing a
delay before the action is executed.
3. Remote Shutdown:
o SHUTDOWN can be used to shut down or restart remote computers if you have
the necessary permissions.
4. Forced Shutdown:
o The command can forcibly close applications, which may be necessary if there
are unresponsive programs.

EXAMPLE

SHUTDOWN /s /t 0

SORT COMMAND
The sort command is a powerful utility in Unix/Linux systems used to sort lines of text files. It
can arrange data in various orders, making it easier to read and analyze.

EXAMPLE

sort filename.txt

USE

The sort command is used to organize lines of text files or output from other commands in a
specified order. Here are some common uses

1. ALPHABETICAL SORTING

sort filename.txt

2. Numerical Sorting

Sort lines containing numbers numerically:

bash
Copy code
sort -n numbers.txt
3. Reverse Sorting

Sort lines in reverse order:

bash
Copy code
sort -r filename.txt
SUBST COMMAND

INTRODUCTION

The subst command is a Windows command-line utility that allows you to create a virtual drive
letter that maps to a specific folder path on your computer. This feature is helpful for simplifying
access to deeply nested directories or frequently used folders.

Key Features

 Virtual Drive Creation: Assigns a drive letter (like Z:) to a folder path, making it easier to
access that folder.
 Temporary Mapping: The mapping is session-specific and is lost after a reboot, making it
ideal for temporary organization.

Example

subst Z: C:\Path\To\Your\Folder
SYSTEMINFO COMMAND

INTRODUCTION

The systeminfo command is a built-in command-line utility in Windows that provides detailed
information about the system's configuration and hardware. It's useful for diagnosing issues,
gathering system specifications, and understanding the environment in which your Windows
operating system is running.

The systeminfo command is a built-in command-line utility in Windows that provides detailed
information about the system's configuration and hardware. It's useful for diagnosing issues,
gathering system specifications, and understanding the environment in which your Windows
operating system is running.

Key Features

 Comprehensive System Information: Displays details such as the operating system


version, hardware configuration, memory, and network adapter information.
 Easy Access: Can be run directly from the Command Prompt, making it accessible for
users and administrators.

EXAMPLE

Systeminfo

tasklist command

Introduction
The tasklist command is a built-in utility in Windows that provides a list of currently running
processes on your system. It is useful for monitoring system activity, diagnosing performance
issues, and managing applications.

Use

This will display a list of active processes along with details such as:

 Image Name: The name of the executable file for the process.
 PID: Process ID, a unique identifier for each running process.
 Session Name: The name of the session in which the process is running.
 Session#: The session number.
 Mem Usage: The amount of memory being used by the process
 Example

EXAMPLE

tasklist
TIME COMMAND

INTRODUCTION

The time command in Windows is a simple command-line utility that allows users to display or
set the system time. It’s useful for checking the current time or changing it when necessary,
typically used in scripts or during troubleshooting.

EXAMPLE

Time

USE

The time command in Windows is primarily used for the following purposes:

1. Displaying Current Time


When you run the time command without any parameters, it displays the current system time.

Usage:

bash
Copy code
time

2. Setting the System Time

You can set the system time to a specific value by providing the desired time in HH:MM

format. This is particularly useful for administrators or in situations where accurate timekeeping
is essential.

Usage:

bash
Copy code
time HH:MM:SS

For example:

bash
Copy code
time 14:30:00

This sets the time to 2:30 PM.


TITLE COMMAND

INTRODUCTION

The title command in Windows is used to set the title of the Command Prompt window. This can
help users organize multiple Command Prompt windows and identify their purpose or content at
a glance.

EXAMPLE

title My Script Window

The title command in Windows is used to set or change the title of the Command Prompt
window. Here are some practical uses of the title command:

1. Organizing Multiple Command Prompt Windows


When working with several Command Prompt windows, setting different titles can help you
quickly identify their purposes. For example, if you have one window for scripting and another
for system monitoring, you can use:

bash
Copy code
title Script Runner

TREE COMMAND

INTRODUCTION

The tree command in Windows is a useful utility that displays a graphical representation of the
directory structure of a specified drive or path. It helps users visualize how folders and
subfolders are organized.

EXAMPLE

tree [drive:][path] [/f] [/a]

USE

The tree command in Windows has several practical uses that can aid users in navigating and
managing their file systems. Here are some key uses:

1. Visualizing Directory Structures


The primary purpose of the tree command is to provide a clear, graphical representation of a
directory structure. This is especially helpful for understanding how folders and subfolders are
organized.

Example:

bash
Copy code
tree C:\Documents

2. Documenting Folder Hierarchies

You can use the tree command to create a textual representation of your directory layout for
documentation purposes. This can be useful for system administrators or users who need to map
out folder structures for sharing or reporting.

Example:

bash
Copy code
tree /f > directory_structure.txt

This command saves the complete directory structure, including files, into a text file.

3. Finding Files and Folders

By using the /f option, you can quickly see all files within a directory and its subdirectories,
helping you locate specific files without manually browsing through folders.

Example:

bash
Copy code
tree C:\Projects /f
Assessing Disk Usage

While the tree command doesn’t provide size information, seeing the number of folders and files
can help users gauge how much content is stored in various locations. This can inform decisions
about cleanup or reorganization.

TYPE COMMAND

INTRODUCTION

The type command in Windows is a simple yet useful utility that displays the contents of a text
file or multiple files in the Command Prompt. It is particularly helpful for quickly viewing file
content without opening a text editor.
USE

 Display Text Files: The primary function is to show the contents of one or more text files.
 Support for Multiple Files: You can specify multiple files to display their contents
sequentially.
 No Editing Capability: The command only shows content; it does not allow for editing or
modifying files

EXAMPLE

type file1.txt file2.txt


VER COMMAND

INTRODUCTION

The ver command in Windows is a simple command-line utility that displays the current version
of the Windows operating system you are running. It is useful for quickly identifying the OS
version without navigating through system settings.

Use

Common Uses

1. Checking Windows Version: Quickly find out which version of Windows you are using.
This can be particularly useful for troubleshooting or when installing software that
requires specific OS versions.
2. Scripting: The ver command can be included in batch scripts to log or check the OS
version programmatically.

EXAMPLE

Ver

Microsoft Windows [Version 10.0.19041.1052]

VERIFY COMMAND
INTRODUCTION

The verify command in Windows is a command-line utility that allows users to enable or disable
the verification of file writes to a disk. When enabled, it ensures that the system verifies that data
has been correctly written to the disk.

Basic Usage

To use the verify command, open the Command Prompt and type:

bash
Copy code
verify [on | off]

Parameters

 on: Enables verification of written data. When this is set, the system checks that data
written to a disk is correct.
 off: Disables verification. This means that the system will not check whether data has
been successfully written.

EXAMPLE

verify on

verify off
VOL COMMAND

INTRODUCTION

The vol command in Windows is a command-line utility that displays the volume label and serial
number of a specified disk drive. It provides a quick way to identify drives, especially when
managing multiple storage devices.

Common Uses

1. Identifying Drives: The vol command helps users identify volume labels and serial
numbers, which can be useful for managing and differentiating between multiple drives.
2. Scripting and Automation: The command can be included in batch scripts to log volume
information or to ensure the correct drives are being referenced in operations.
3. Troubleshooting: It can assist in diagnosing drive-related issues, particularly when
verifying that a drive is recognized by the system.

EXAMPLE

4. vol D:

XCOPY COMMAND

The xcopy command in Windows is a powerful command-line utility used for copying
files and directories, including their subdirectories. It offers more features than the basic
copy command, making it suitable for more complex file management tasks.
USE

The xcopy command in Windows has several practical uses, making it a versatile tool for file
management. Here are some key applications:

1. Copying Files and Directories

xcopy is primarily used to copy files and entire directory structures, including subdirectories,
which is useful for backing up or transferring data.

xcopy C:\Source D:\Backup /s

This command copies the Source directory and all its subdirectories (except empty ones) to the
Backup location.

2. Backing Up Data

You can use xcopy to create backups of important files and directories. By specifying options,
you can ensure that hidden and system files are included.

EXAMPLE

xcopy C:\example.txt D:\

WMIC COMMAND

The WMIC (Windows Management Instrumentation Command-line) command in


Windows is a powerful command-line utility that provides a command-line interface to
Windows Management Instrumentation (WMI). It allows users to perform a variety of
administrative tasks and query system information.

The WMIC (Windows Management Instrumentation Command-line) command has several


practical uses, making it a versatile tool for system management and information retrieval. Here
are some key applications:
1. Retrieving System Information

You can use WMIC to gather detailed information about the operating system, hardware, and
software.

Example:

bash
Copy code
wmic os get caption, version, osarchitecture

This command retrieves the OS name, version, and architecture.

2. Managing Installed Software

WMIC allows you to list, install, or uninstall software packages on the system.

Example:

 List Installed Software:

bash
Copy code
wmic product get name, version

 Uninstall Software:

bash
Copy code
wmic product where "name='SoftwareName'" call uninstall

3. Monitoring Hardware Components

You can query information about various hardware components, such as CPUs, memory, and
disks.
Example:

bash
Copy code
wmic cpu get name, currentclockspeed

This command displays the CPU name and its current clock speed.

4. Checking Disk Space

WMIC can be used to monitor available disk space on logical drives.

Example:

bash
Copy code
wmic logicaldisk get name, size, freespace

This command shows the total size and free space for each drive.

5. Managing Processes

You can list, start, and terminate processes running on the system.

Examples:

 List Running Processes:

bash
Copy code
wmic process get name, processid

 Terminate a Specific Process:

bash
Copy code
wmic process where "name='notepad.exe'" delete

6. Gathering Network Information

WMIC can provide details about network adapters and their configurations.

Example:

bash
Copy code
wmic nic get name, macaddress, speed

This command retrieves the name, MAC address, and speed of each network adapter.

7. Querying BIOS Information

You can obtain details about the system's BIOS, including version and manufacturer.

Example:

bash
Copy code
wmic bios get manufacturer, version

8. Automating Administrative Tasks

WMIC can be included in scripts for automating routine administrative tasks, such as monitoring
system health or managing software installations.

You might also like