A way to secure data on a flash drive without using any software is to turn it on in read-only mode

Flash drives or USB keys are one of the most important means of transferring and saving data these days because they are very practical. Unfortunately, anyone who gains access to the flash drive can modify or delete that important data. Therefore, in this post, we will learn about a simple way to protect files on the flash drive from modification or deletion by activating read-only mode on the flash drive without programs.
Connect the flash drive to the computer, then open the Run window by pressing Windows + R and typing the command diskpart
We will review the disks connected to the computer by typing the command list disk. You can identify the flash drive by its size, then select it by entering the command Select disk 1 (number 1 is the flash drive number as in the picture)
After selecting the flash drive, type the command attribute disk set readonly to activate read-only mode on the flash drive.
Now if you try to make any modification to the files inside the flash drive, such as deleting a file, you will not find this option at all. Also, if you try to copy a file to the flash drive, we will find that it is not possible because the flash drive is in read-only status.
To cancel this mode and activate the read and write modes on the flash drive again, you can perform the same previous steps, but enter this command instead of the activation command attributes disk clear readonly
This is a useful and reliable way to protect your storage media from malware infection.