3

I'm working on an embedded computer in kiosk mode, where the users can insert an USB flash drive.

Even if I add a "Eject USB storage device" button in my app's GUI, often, some users won't use it and unplug their device directly.

How can I configure Windows such that all USB flash drives inserted in the future won't require "Eject"?

(Even if the transfers are slower, it's fine).

I know that once a USB flash drive is inserted, we can set this setting for this particular device, and uncheck these 2 checkboxes:

enter image description here

but how to make this setting for all devices that will be plugged in the future?

Link on the Microsoft website.

Basj
  • 2,143

2 Answers2

1

As said in the comments, in Windows 10 version 1809 and later, the write cache is disabled by default for removable devices: official source.

For Windows 7, I might have the building blocks you need to create the solution, but I can't test a complete solution because I don't have the right environment. My apologies if it doesn't work.

The building blocks are as follows :

  • Find out the physical address of the USB drive, such as PHYSICALDRIVE3, by connecting a USB and using the following command in CMD:

    wmic diskdrive list brief
    
  • For disabling the write cache for the device, you will need the old and disappeared utility described in Microsoft Knowledge Base Article - 811392 (Internet Archive link)

  • I have found a download link for the utility in dskcache.exe File Download

  • The command for disabling the write cache requires Administrator permission and looks like this in CMD:

    dskcache.exe -w PHYSICALDRIVE3
    
  • If this old program works on Windows 7, you could set the Task Scheduler to run it automatically when a USB is introduced. See this answer.

An alternative to dskcache is described in this answer and can be downloaded from here (the text is in Chinese but the big green button is unmistakable).

Basj
  • 2,143
harrymc
  • 498,455
1

I may have overthought this question.

Quick removal seems to be the default on both Windows 7 and Windows 10. I just tried by inserting a flash drive:

enter image description here

I wonder if it's the default for all USB flash drives? Or if USB2 / USB3 will change anything?

(Remark: Then why did we all take the habit to click "Safely remove..." in the tray notification icon if quick removal is the default?)

Basj
  • 2,143