Jump to content

cmd script - make USB read only during install?


Damnation

Recommended Posts

I've got windows install booting off a USB

I would like to have a command prompt script so that it will find the USB and set it to read-only during install - so that you can't inadvertently format the USB being booted

and then have a post install script that sets it back to writable

can this be done?

any help would be appreciated

Link to comment
Share on other sites


I've got windows install booting off a USB

I would like to have a command prompt script so that it will find the USB and set it to read-only during install - so that you can't inadvertently format the USB being booted

and then have a post install script that sets it back to writable

can this be done?

any help would be appreciated

Didn't you ALREADY get a possible solution to this?

http://reboot.pro/17636/

jaclaz

Link to comment
Share on other sites

only partially,

I can set it to read only manually,

but I would like it scripted

I think you missed my hint. :ph34r:

You asked a base question on another forum in the grub4dos section.

You got a (valid) reply.

BUT since you slipped on a chocolate-covered banana :

http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/put-down-the-chocolate-covered-banana.html

You changed the question.

And you got another (valid) reply to that new question (that in the meantime has become having nothing to do with grub4dos)

Instead of continuing there you decided to bring the topic here, WITHOUT citing the original thread where a (valid) solution has already been given, i.e. omitting the relevant info that you already have, and starting again "from scratch".

As I see it, your current question is (or should be):

I have a set of command lines that do exactly what i need, see here:

http://reboot.pro/17636/

How can the commands be changed to automatically detect the right device/volume?

How can I put them together in a script so that they are executed in an Unattended setup of 7 automatically?

This way also someone that knows nothing about grub4dos, diskpart or Unattended install of a 7 from a .iso may help in assembling the script and someone else that knows nothing of grub4dos or scripting but is familiar wth Unattended installs of 7 may contribute, as well as experts of diskpart only...

In other words the more info you provide as backup/background of a question, the more likely it is that people will be able to provide you with assisatance. :)

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

OK sorry for the confusion, I should clarify

I would like a command prompt script (or batch file, if the term is still used)

to loop through all the drive letters,



FOR %%i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %%i:\foundme.txt

and then if it's finds foundme.txt, to set that drive, based on the drive letter to read only, using diskpart

did I describe it well enough?

Link to comment
Share on other sites

OK sorry for the confusion, I should clarify

I would like a command prompt script (or batch file, if the term is still used)

to loop through all the drive letters,



FOR %%i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %%i:\foundme.txt

and then if it's finds foundme.txt, to set that drive, based on the drive letter to read only, using diskpart

did I describe it well enough?

Yes, and the topic strangely enough, has already been discussed at length.

The actual issue is "translating" an assigned drive letter to the actual disk/volume.

Some "suitable" ways have been developed, see:

page__st__20__p__821889?do=embed&embedDo=findComment%3Fcomment%3D821889' frameborder='0' data-embedContent>

ooops, back to boot-land reboot.pro:

http://reboot.pro/index.php?showtopic=8219

(of course only if a "third party tool" is acceptable, the thread(s) here by Victor888 contain more "native only" approaches/ideas )

Additionally (and if I remember correctly) the PE 3.x (please read as your Windows7 install environment) may be running a "enhanced" version of WMIC, so possibly that could be another path to follow.

Also, you may get some ideas from this little .vbs:

Assembling these ideas and testing them is of course up to you. :)

But what you need seems to me like a very simplified subset.

Boot to that .iso , open a command prompt and run in it:

diskpart

[ENTER]

list disk

[ENTER]

list volume

[ENTER]

select disk 0
list partitions

[ENTER]

select disk 1
list partitions

[ENTER]

What do you get as output at each command?

jaclaz

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...