Question Locked

Batch file needed for USB write and read only.

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a requirement for a office purpose. I want to give a usb pendrive write protected and read only permission, for any system I connect, the data shoudnt get deleted anytime in the pendrive. So I know through dispart from cmd we can do this but can anyone help me to create a batch file so the user (non IT) can do it from their own pc without any fuss just by clicking the batch file shortcut rather than typing the commands from command prompy dispart. So pls help me.

9 replies

by jobsp90

Actually after copying the data to pendrive only batch file should run, then no one should be able to modify the contents in the usb drive.

by rproffitt edited

Keep in mind that if I plug that drive into my PC it doesn't OBEY those settings. I can format the drive, delete files, edit and so on because my PC is on Linux. Windows "permissions" are not recognized there.

I've read such requests before and it's always someone new in the IT group. You try to be gentle as they are learning how things actually work.

by kees_b edited

A batchfile is a text-file (can be made in Notepad) with exactly the commands you type in cmd), en ends with a line containing exit.

The complication is that you include the drive-letter you type in the batchfile.
The easy solution is to make different batchfiles for d:, e:, f: and so on.
A somewhat more difficult solution is to ask the user to type it and use his answer. Use echo to ask the user to type something, then set to set a parameter and then encolose it in two %-characters to use it.

However, anybody can see that batch-file, so anybody can undo it and then change the data. So I wonder if it's the best way to ensure the integrity of the data the user typed. It might be better to use a password protected website to enter the data to.

by jobsp90

Can u pls prepare a batch file with a sample one. Rest I will do it accordingly.

by jobsp90

any change i have to make other than the usb number?

by kees_b

Just try and test until it works as you want it to work.

by rproffitt edited

How airtight must this be? And who is “no one”?

This discussion is closed to new replies.