Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

cmd script - make USB read only during install?


  • Please log in to reply
5 replies to this topic

#1
Damnation

Damnation

    Newbie

  • Member
  • 20 posts
  • Joined 06-September 12
  • OS:Windows 7 x64
  • Country: Country Flag
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


How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,584 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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
Damnation

Damnation

    Newbie

  • Member
  • 20 posts
  • Joined 06-September 12
  • OS:Windows 7 x64
  • Country: Country Flag
only partially,

I can set it to read only manually,

but I would like it scripted

#4
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,584 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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):

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, 14 October 2012 - 04:46 AM.


#5
Damnation

Damnation

    Newbie

  • Member
  • 20 posts
  • Joined 06-September 12
  • OS:Windows 7 x64
  • Country: Country Flag
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
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,584 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users