MSFN Forum: cmd script - make USB read only during install? - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

cmd script - make USB read only during install?

#1 User is offline   Damnation 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 06-September 12
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 14 October 2012 - 03:16 AM

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


#2 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,578
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 14 October 2012 - 03:38 AM

View PostDamnation, on 14 October 2012 - 03:16 AM, said:

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

#3 User is offline   Damnation 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 06-September 12
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 14 October 2012 - 03:55 AM

only partially,

I can set it to read only manually,

but I would like it scripted

#4 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,578
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 14 October 2012 - 04:43 AM

View PostDamnation, on 14 October 2012 - 03:55 AM, said:

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.ntlw...red-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):

Quote

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

This post has been edited by jaclaz: 14 October 2012 - 04:46 AM


#5 User is offline   Damnation 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 06-September 12
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 14 October 2012 - 05:58 AM

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?

#6 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,578
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 14 October 2012 - 07:41 AM

View PostDamnation, on 14 October 2012 - 05:58 AM, said:

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:
http://www.msfn.org/...889#entry821889
ooops, back to boot-land reboot.pro:
http://reboot.pro/in...?showtopic=8219
(of course only if a "third party tool" is acceptable, the thread(s) here by Victor888 contain more "native only" approaches/ideas )
http://www.msfn.org/...-drive-letters/

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:
http://www.msfn.org/...ty-for-windows/

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

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy