1. Note down the free space in bytes left in your USB drive. To do that, just right-click with your mouse on your USB drive and select properties where you can find the Used space and free space shown in bytes.
2. Go to start–>Run… and type cmd and click Ok to open the command prompt(DOS) window.
3. At the command prompt type the command having the syntax as follows:
fsutil file createnew [USB drive pathfilename] [free space in bytes]
for example, if the drive letter for your USB drive is ‘K’, the free space available is 1528864758 bytes and filename you want to use is dummyfile then the command you have to type is:
fsutil file createnew k:dummyfile 1528864768
As soon as you press ENTER after giving this command a file will be created in you USB drive occupying all the free space available.
Now your USB drive cannot accommodate any incoming viruses as it has zero free space. You can check that from your drive properties. As you can see in the image below the free space left is zero as we have created a dummy file with all the free space available in the step above.
And whenever you want to copy files to your USB drive from secured sources, just delete that dummyfile created and copy the data you wanted and again create a dummyfile that occupies the remaining free space.
This command prompt trick is the best preventive measure to block any virus form entering your USB drive.