Windows Deployment Command-Line Tools

CMD

What is meant by command line?

The command line is a blank line and cursor on the screen, allowing the user to type in instructions for immediate execution. All major operating systems (Windows, Mac, Unix, Linux, etc.) … After typing a command, it is executed by pressing the Enter key.

A command-line interface processes commands to a computer program in the form of lines of text. The program which handles the interface is called a command-line interpreter or command-line processor.

What is the command line in Windows?

The command line, also called the Windows command linecommand screen, or text interface, is a user interface that’s navigated by typing commands at prompts, instead of using a mouse. For example, the Windows folder in a Windows command line is “C:\Windows>” (as shown in the picture)

How does command line work?

CLI allows a user to perform tasks by entering commands. Its working mechanism is very easy, but it is not user friendly. Users enter the specific command, press “Enter”, and then wait for a response. … Command line interpreter is used to implement the text-based interface.

What are the main features of command line?

Following are some of the Command Line Features :

  • Command History. History option enables TL1 Agent to record all the commands which are executed in the history list. …
  • Command Completion. …
  • Command Line Editing. …
  • List of Commands. …
  • Complete Command Syntax. …
  • Escape Key.

WINDOWS DEPLOYMENT COMMAND LINE TOOLS

BCDBoot is a command-line tool used to configure the boot files on a PC or device to run the Windows operating system. You can use the tool in the following scenarios:

  • Add boot files to a PC after applying a new Windows image. In a typical image-based Windows deployment, use BCDBoot to set up the firmware and system partition to boot to your image. To learn more, see Capture and Apply Windows, System, and Recovery Partitions.
  • Set up the PC to boot to a virtual hard disk (VHD) file that includes a Windows image. To learn more, see Boot to VHD (Native Boot): Add a Virtual Hard Disk to the Boot Menu.
  • Repair the system partition. If the system partition has been corrupted, you can use BCDBoot to recreate the system partition files by using new copies of these files from the Windows partition.
  • Set up or repair the boot menu on a dual-boot PC. If you’ve installed more than one copy of Windows on a PC, you can use BCDBoot to add or repair the boot menu.

File Locations

In Windows and Windows Preinstallation Environment (WinPE)%WINDIR%\System32\BCDBoot.exe
In the Windows Assessment and Deployment Kit (Windows ADK):C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\BCDBoot\BCDBoot.exe

Supported operating systems

BCDBoot can copy boot environment files from images of Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista, Windows Server 2016 Technical Preview, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2, or Windows Server 2008.

How It Works

To configure the system partition, BCDBoot copies a small set of boot-environment files from the installed Windows image to the system partition.

BCDBoot can create a Boot Configuration Data (BCD) store on the system partition using the latest version of the Windows files:

  • BCDBoot creates a new BCD store and initialize the BCD boot-environment files on the system partition, including the Windows Boot Manager, using the %WINDIR%\System32\Config\BCD-Template file.
  • New in Windows 10: During an upgrade, BCDBoot preserves any other existing boot entries, such as debugsettings, when creating the new store. Use the /c option to ignore the old settings and start fresh with a new BCD store.
  • If there is already a boot entry for this Windows partition, by default, BCDBoot erases the old boot entry and its values. Use the /m option to retain the values from an existing boot entry when you update the system files.
  • By default, BCDBoot moves the boot entry for the selected Windows partition to the top of the Windows Boot Manager boot order. Use the /d option to preserve the existing boot order.

On UEFI PCs, BCDBoot can update the firmware entries in the device’s NVRAM:

  • BCDBoot adds a firmware entry in the NVRAM to point to the Windows Boot Manager. By default, this entry is placed as the first item in the boot list. Use the /p option to preserve the existing UEFI boot order. Use /addlast to add it to the bottom of the boot order list.

Command-Line Options

The following command-line options are available for BCDBoot.exe.

BCDBOOT <source> [/l <locale>] [/s <volume-letter> [/f <firmware type>]] [/v] [/m [{OS Loader GUID}]] [/addlast or /p] [/d] [/c]

OptionDescription
<source>Required. Specifies the location of the Windows directory to use as the source for copying boot-environment files.The following example initializes the system partition by using BCD files from the C:\Windows folder:Copybcdboot C:\Windows
/l <locale>Optional. Specifies the locale. The default is US English (en-us).The following example sets the default BCD locale to Japanese:Copybcdboot C:\Windows /l ja-jp
/s <volume letter>Optional. Specifies the volume letter of the system partition. This option should not be used in typical deployment scenarios.Use this setting to specify a system partition when you are configuring a drive that will be booted on another computer, such as a USB flash drive or a secondary hard drive.UEFI:BCDBoot copies the boot files to either the EFI system partition, or the partition specified by the /s option.BCDBoot creates the BCD store in the same partition.By default, BCDBoot creates a Windows Boot Manager entry in the NVRAM on the firmware to identify the boot files on the system partition. If the /s option is used, then this entry is not created. Instead, BCDBoot relies on the default firmware settings to identify the boot files on the system partition. By the UEFI 2.3.1 spec, the default firmware settings should open the file: \efi\boot\bootx64.efi in the EFI System Partition (ESP).BIOS:BCDBoot copies the boot files to either the active partition on the primary hard drive, or the partition specified by the /s option.BCDBoot creates the BCD store in the same partition.The following example copies BCD files from the C:\Windows folder to a system partition on a secondary hard drive that will be booted on another computer. The system partition on the secondary drive was assigned the volume letter S:Copybcdboot C:\Windows /s S:The following example creates boot entries on a USB flash drive with the volume letter S, including boot files to support either a UEFI-based or a BIOS-based computer:Copybcdboot C:\Windows /s S: /f ALL
/f <firmware type>Optional. Specifies the firmware type. Valid values include UEFIBIOS, and ALL.On BIOS/MBR-based systems, the default value is BIOS. This option creates the \Boot directory on the system partition and copies all required boot-environment files to this directory.On UEFI/GPT-based systems, the default value is UEFI. This option creates the \Efi\Microsoft\Boot directory and copies all required boot-environment files to this directory.When you specify the ALL value, BCDBoot creates both the \Boot and the \Efi\Microsoft\Boot directories, and copies all required boot-environment files for BIOS and UEFI to these directories.If you specify the /f option, you must also specify the /s option to identify the volume letter of the system partition.The following example copies BCD files that support booting on either a UEFI-based or a BIOS-based computer from the C:\Windows folder to a USB flash drive that was assigned the volume letter S:Copybcdboot C:\Windows /s S: /f ALL
/vOptional. Enables verbose mode. Example:Copybcdboot C:\Windows /v
/m [{OS Loader GUID}]Optional. Merges the values from an existing boot entry into a new boot entry.By default, this option merges only global objects. If you specify an OS Loader GUID, this option merges the loader object in the system template to produce a bootable entry.The following example merges the operating-system loader in the current BCD store that the specified GUID identifies in the new BCD store:Copybcdboot c:\Windows /m {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
/addlastOptional. Specifies that the Windows Boot Manager firmware entry should be added last. The default behavior is to add it first. Cannot be used with /p.Copybcdboot C:\Windows /addlast
/pOptional. Specifies that the existing Windows Boot Manager firmware entry position should be preserved in the UEFI boot order. If entry does not exist, a new entry is added in the first position. Cannot be used with /addlast.By default, during an upgrade BCDBoot moves the Windows Boot Manager to be the first entry in the UEFI boot order.Copybcdboot C:\Windows /p bcdboot C:\Windows /p /d
/dOptional. Preserves the existing default operating system entry in the {bootmgr} object in Windows Boot Manager.Copybcdboot C:\Windows /d
/cOptional. Specifies that any existing BCD elements should not be migrated.New for Windows 10: By default, during an upgrade, BCD elements such as debugsettings or flightsigning are preserved.Copybcdboot C:\Windows /c

diskpart

Applies to: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, and Windows Server 2008 R2, Windows Server 2008

The diskpart command interpreter helps you manage your computer’s drives (disks, partitions, volumes, or virtual hard disks).

Before you can use diskpart commands, you must first list, and then select an object to give it focus. After an object has focus, any diskpart commands that you type will act on that object.

List available objects

You can list the available objects and determine an object’s number or drive letter by using:

  • list disk – Displays all the disks on the computer.
  • list volume – Displays all the volumes on the computer.
  • list partition – Displays the partitions on the disk that has focus on the computer.
  • list vdisk – Displays all the virtual disks on the computer.

After you run the list commands, an asterisk (*) appears next to the object with focus.

Determine focus

When you select an object, the focus remains on that object until you select a different object. For example, if the focus is set on disk 0 and you select volume 8 on disk 2, the focus shifts from disk 0 to disk 2, volume 8.

Some commands automatically change the focus. For example, when you create a new partition, the focus automatically switches to the new partition.

You can only give focus to a partition on the selected disk. After a partition has focus, the related volume (if any) also has focus. After a volume has focus, the related disk and partition also have focus if the volume maps to a single specific partition. If this isn’t the case, focus on the disk and partition is lost.

Syntax

To start the diskpart command interpreter, at the command prompt type:Copy

diskpart <parameter>

 Important

You must be in your local Administrators group, or a group with similar permissions, to run diskpart.

Drop your comment

Related Post

Leave a Reply

Your email address will not be published.