Install Windows 7 Dari Flashdisk Command Prompt

Install Windows 7 Dari Flashdisk Command Prompt Average ratng: 7,2/10 9574 votes

Cara membuat flashdisk bootable dangan Command Prompt: 1. Pada perangkat komputer lain yang berjalan di windows XP/Vista/7, klik Run kemudian ketik CMD (dengan menekan tombol bendera Windows + R).

Active11 months ago

I'm constructing a backup script for Windows 7, and the last action I want it to perform is to safely 'remove' the USB drive that it is backing up to. I am under the impression that plugging the drive into the same USB port all the time will keep the same DEV_ID (correct me if I'm wrong). With a command line (or PowerShell), how can I tell Windows to safely remove the hardware automatically without user input?

Just as a place holder, other OSes that may have a way to do this would be great to know as well.

Peter MortensenPrompt
8,57916 gold badges62 silver badges85 bronze badges
Canadian LukeCanadian Luke
18.5k33 gold badges97 silver badges153 bronze badges

5 Answers

stijnstijn
1,7371 gold badge15 silver badges24 bronze badges

Besides Uwe Sieber's RemoveDrive mentioned in the other answer, there are a whole bunch of utilities that can accomplish this. A small list follows:

  • USB Disk Ejector is primarily a GUI-based utility but can be used equally well from the command-line to eject the drive that the program is running from, or any drive by specifying the drive letter / (partial) drive name / mountpoint etc. Free and open source.

  • USB Safely Remove is not free but it's a disk removal utility on steroids, with lots of advanced features, including of course command-line support. Zentimo is its bigger brother, with evenmorefeatures.

  • Microsoft's own DevCon is the command-line version of Device Manager. Besides the original Win2K/XP-era version available from the KB page, there are newer releases (both 32 and 64-bit) available from various MS sources as mentioned in this Where to find DevCon.exe article. DevCon.exe for Windows 7 (and probably Windows 8 as well) can be found buried in the appropriate Windows Driver Kit (WDK), as mentioned in this thread (which also contains download links to the extracted executable).

    devcon status * or devcon hwids * or devcon findall =usb (for a more compact listing) should tell you the hardware ID of the device. For example:

    USBVID_0781&PID_71130001162825
    Name: USB Mass Storage Device
    Driver is running.

    You can then try removing the device with devcon remove 'USBVID_0781&PID_7113' (wildcards like * are allowed, but be careful or you might end up removing something else entirely!)

Someone asked 'Is there a DOS prompt (cmd.exe from Win7) command to eject a thumb drive?' which was unfortunately closed as a duplicate of this thread. However, the question was about ejecting USB drives while in the Windows Recovery Console / System Recovery Command Prompt, so it is unlikely any of the utilities above will help. In such a situation, the following method using Diskpart should work:

  1. Type diskpart and wait for the diskpart prompt (DISKPART>)

  2. Type list volume

  3. Note the volume number of the USB drive carefully (use listed properties such as drive letter, label, type and size for help)

  4. Type select volume <number>, where <number> is the volume number noted above

  5. Type remove all dismount

  6. Type exit to quit Diskpart

Now you should be able to safely remove your USB drive without fear of data loss.

Community
KaranKaran
50.5k16 gold badges95 silver badges167 bronze badges

To answer to this question.. You don't need third party stuff.

Reinstall Windows From Command Prompt

With a Command Line (or PowerShell), how can I tell Windows to safely remove the hardware automatically without user input?

Run this command: RunDll32.exe shell32.dll,Control_RunDLL hotplug.dllto bring up the Safely Remove Hardware dialog box:

climenoleclimenole
3,0401 gold badge14 silver badges29 bronze badges

Since it's a backup device, it means it's a storage device, therefore it can be done from powershell - just replace X: with your desired drive letter:

OvermindOvermind
8,2333 gold badges16 silver badges31 bronze badges

According to this 7tutorials-article, you can enable safe unplugging by setting 'Quick removal'. This will disable write caching per device, of which the performance impact is 'negligible'?Their steps for Windows 7 are below.

(Edit) According to this howtogeek-article, you should still be careful when setting 'Quick removal'. This will disable write caching, and will thus prevent most problems. But some program(s) may still be writing stuff 'live', until explicitly ejected/removed. (End of edit) Manvasanai serial episode 100.

Command Prompt From Windows Setup

Steps:

  • plug in the device in the USB drive
  • open Device Manager
  • expand Disk Drives
  • right-click your removable drive, e.g. 'USB2.0 Flash Disk USB Device.'
  • select Properties
  • click the Policies tab
  • enable 'Quick removal' (disable 'Better performance')

(Edit) Note that you need to use Device Manager to change the setting, it can not be done from the File Explorer. (At least in my Windows 10 edition.)

Yahoo SeriousYahoo Serious
Dari

Not the answer you're looking for? Browse other questions tagged windowscommand-linebatch-file or ask your own question.

Posted on