简体   繁体   中英

Powershell command to format the usb drive even though a file was opened

I need to format a USB drive even though the file was opened. Need to have a powershell command which need to execute using java program.

Currently, we are using, powershell.exe format /FS:FAT32 E: /Q /v:Volume Name

The above command works fine, but it does not format when any of files from USB drive oepned. I wanted to force format eventhough the files were opened.

Can anyone help if any powershell command exists which would force format?

According to the Microsoft docs for the format command ( Format | Microsoft Docs ) what you want can be indirectly solved by using the /x parameter which

Causes the volume to dismount, if necessary, before it is formatted. Any open handles to the volume will no longer be valid.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM