Batch script to prepare Windows 7 Bootable Pendrive.

December 18, 2014 § Leave a comment

Its easy to prepare Windows 7 Bootable Pendrive if you know some commands. However, you will forget the commands and their sequence easily when you need to setup windows next time later. To overcome this problem i created a script for myself. I think it will be useful to you also.

Write the following commands to a text file and save it with .bat extension e.g PreparePendrive.bat and then right click on it and click Run as Administrator. But Beware:

  1. Keep a backup of the contents of your pendrive because it will be formatted.
  2. You have one hard disk in your computer and one pendrive. there is no other drive plugged in.

And then copy all the contents of the Windows 7 Bootable DVD to the pendrive. And Its ready to boot..

del DskPrtCmd.txt
REM ECHO DISKPART > DskPrtCmd.txt
ECHO LIST DISK >> DskPrtCmd.txt
ECHO SELECT DISK 1 >> DskPrtCmd.txt
ECHO CLEAN >> DskPrtCmd.txt
ECHO CREATE PARTITION PRIMARY >> DskPrtCmd.txt
ECHO SELECT PARTITION 1 >> DskPrtCmd.txt
ECHO ACTIVE >> DskPrtCmd.txt
ECHO FORMAT FS=NTFS QUICK >> DskPrtCmd.txt
ECHO ASSIGN >> DskPrtCmd.txt
ECHO EXIT >> DskPrtCmd.txt

diskpart /s DskPrtCmd.txt
del DskPrtCmd.txt
pause

Or if you are too lazy, download it from here: https://github.com/khairulhasanmd/Prepare-Win7-Bootable-Pendrive

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Batch script to prepare Windows 7 Bootable Pendrive. at khairulhasanmd.

meta

%d bloggers like this: