Jump to content

more compatible batch file for ording drive letters


victor888

Recommended Posts

Just to keep things as together as possible, here:

http://www.boot-land.net/forums/index.php?showtopic=8219

is a small batch to take advantage of the features of the dd --list mentioned before.

Example output:


C:\VSS>ddlist
Drives by drive letter:
c: 0,1 Fixed HarddiskVolume1 {b0b284c3-8a33-11dd-8781-806d6172696f}
d: 1,1 Fixed HarddiskVolume2 {b0b284c4-8a33-11dd-8781-806d6172696f}
e: 3,1 Fixed HarddiskVolume3 {98f06d4c-9506-11dd-8147-001fc6bb76ce}
f: 8,1 Fixed HarddiskVolume11 {0cb309be-d343-11dd-ab05-001fc6bb76ce}
g: 3,2 Fixed HarddiskVolume4 {98f06d4d-9506-11dd-8147-001fc6bb76ce}
h: 3,3 Fixed HarddiskVolume5 {98f06d4e-9506-11dd-8147-001fc6bb76ce}
i: x,x CD-ROM CdRom0 {80cf88c2-8a34-11dd-813c-806d6172696f}
j: 2,1 Removable Harddisk2\DP(1)0-0+5 {5d3e8800-9c1f-11dd-8148-001fc6bb76ce}
k: 4,1 Removable Harddisk4\DP(1)0-0+f {80cf88c3-8a34-11dd-813c-806d6172696f}
l: 5,1 Removable Harddisk5\DP(1)0-0+10 {80cf88c4-8a34-11dd-813c-806d6172696f}
m: 6,1 Removable Harddisk6\DP(1)0-0+11 {80cf88c5-8a34-11dd-813c-806d6172696f}
n: 7,1 Removable Harddisk7\DP(1)0-0+12 {80cf88c6-8a34-11dd-813c-806d6172696f}
o: 3,4 Fixed HarddiskVolume6 {98f06d4f-9506-11dd-8147-001fc6bb76ce}
Premere un tasto per continuare . . .

Drives by connection:
c: 0,1 Fixed HarddiskVolume1 {b0b284c3-8a33-11dd-8781-806d6172696f}
d: 1,1 Fixed HarddiskVolume2 {b0b284c4-8a33-11dd-8781-806d6172696f}
j: 2,1 Removable Harddisk2\DP(1)0-0+5 {5d3e8800-9c1f-11dd-8148-001fc6bb76ce}
e: 3,1 Fixed HarddiskVolume3 {98f06d4c-9506-11dd-8147-001fc6bb76ce}
g: 3,2 Fixed HarddiskVolume4 {98f06d4d-9506-11dd-8147-001fc6bb76ce}
h: 3,3 Fixed HarddiskVolume5 {98f06d4e-9506-11dd-8147-001fc6bb76ce}
o: 3,4 Fixed HarddiskVolume6 {98f06d4f-9506-11dd-8147-001fc6bb76ce}
k: 4,1 Removable Harddisk4\DP(1)0-0+f {80cf88c3-8a34-11dd-813c-806d6172696f}
l: 5,1 Removable Harddisk5\DP(1)0-0+10 {80cf88c4-8a34-11dd-813c-806d6172696f}
m: 6,1 Removable Harddisk6\DP(1)0-0+11 {80cf88c5-8a34-11dd-813c-806d6172696f}
n: 7,1 Removable Harddisk7\DP(1)0-0+12 {80cf88c6-8a34-11dd-813c-806d6172696f}
f: 8,1 Fixed HarddiskVolume11 {0cb309be-d343-11dd-ab05-001fc6bb76ce}
i: x,x CD-ROM CdRom0 {80cf88c2-8a34-11dd-813c-806d6172696f}
Premere un tasto per continuare . . .

jaclaz

Edited by jaclaz
Link to comment
Share on other sites


ddlist.cmd is very handy and is giving for each drive all important identification parameters in one line.

Now it is easy to relate drive letter to harddisk and partition number.

For the layout it might be preferable to use no TAB and to make it similar to symbol2mvol.cmd

Thanks jaclaz for this batch program :)

Link to comment
Share on other sites

Just for comparison with BootLand Forum http://www.boot-land.net/forums/index.php?...=6492&st=10

Let's test the following CODE and CODEBOX for Copy and Paste in Notepad

using different Browsers:

CODE

Copy this text from CODE or CODEBOX in your browser display and Paste in Notepad
The second line has SPACE separated Words
The third line has multiple SPACE separated Words
The fourth line has TAB separated Words


The seventh line appears after empty fifth and sixth line

The result using IE7 as browser is interesting and the same as for BootLand.

On Copy in Notepad we see:

For CODE the TAB character is replaced by 4 Spaces, rest is OK

For CODEBOX all CR+LF are gone (everything in 1 line), but multiple SPACE and TAB are preserved

For CODEBOX all empty lines are lost, but reappear in Post Edit or Post Reply Box

How does this compare to Opera or FireFox as Browser ?

Edited by wimb
Link to comment
Share on other sites

Opera works correctly, 100% with CODEBOX, BUT with the CODE, TABs are converted in multiple (4) spaces. This latter behaviour is a known thing, and it is always a good idea when using TABs, to specify where they are.

I haven't a Firefox installed now, so I cannot say. :unsure:

jaclaz

Link to comment
Share on other sites

And Here are the results for Firefox:

Firefox Copy CODE to Notepad:

TAB is replaced by 4 SPACES, rest OK ;)

Firefox COPY CODEBOX to Notepad:

TAB and multiple SPACE are replaced by single SPACE :ph34r:

Rest (CR+LF and empty lines) displayed and Copy OK :thumbup

So Firefox is in this respect different as compared to IE7, but also NOT perfect ;)

BootLand Forum gives the same results for Firefox as compared to MSFN Forum

CONCLUSION:

The most safe way to get your prgram code is to use Copy from Post Reply Box and Paste in Notepad ;)

Edited by wimb
Link to comment
Share on other sites

CONCLUSION:

The most safe way to get your prgram code is to use Copy from Post Reply Box and Paste in Notepad ;)

MY CONCLUSION:

The most safe way, not only to get a program in CODEBOX, is to use a GOOD browser (read OPERA).

;)

jaclaz

Link to comment
Share on other sites

  • 1 year later...

Hi,

I just read this interesting topic, i would like to know if it's possible to remove space from %%A variable ?

I try to execute the following code :

for /F "tokens=1 delims=:\" %%A IN ('MOUNTVOL^|FINDSTR [A-Z]:\\') do net share %%A=%%A: /GRANT:"Tout le monde",FULL

Result is that the space in %%A will block the NET SHARE command.

c:\net share ........ E= .......... E: /GRANT:"Tout le monde",FULL

....... = space

I need to obtain the drive letter from MountVol without space behind.

Many Thks for your help.

Regards.

Edited by ElrickLandon
Link to comment
Share on other sites

I need to obtain the drive letter from MountVol without space behind.

Go by steps. :)

Open a command prompt.

Run in it

MOUNTVOL

[ENTER]

How does the output look?

Now run

MOUNTVOL | FIND ":\"

[ENTER]

How does the output look?

Now run

FOR /F "tokens=1 delims=:" %A in ('MOUNTVOL ^| FIND ":\"') DO ECHO x%Ax

[ENTER]

How does the output look?

Now run

FOR /F "tokens=1 delims=: " %A in ('MOUNTVOL ^| FIND ":\"') DO ECHO x%Ax

[ENTER]

please note how the above has a [sPACE] between

"tokens=1 delims=:

and the closing double quote:

"

How does the output look? ;)

jaclaz

Link to comment
Share on other sites

Hi,

I just read this interesting topic, i would like to know if it's possible to remove space from %%A variable ?

I try to execute the following code :

for /F "tokens=1 delims=:\" %%A IN ('MOUNTVOL^|FINDSTR [A-Z]:\\') do net share %%A=%%A: /GRANT:"Tout le monde",FULL

Result is that the space in %%A will block the NET SHARE command.

c:\net share ........ E= .......... E: /GRANT:"Tout le monde",FULL

....... = space

I need to obtain the drive letter from MountVol without space behind.

Many Thks for your help.

Regards.

Try using a few more lines! (attempting to compact everything on one line will not make your batch file run any faster)

@ECHO OFF
FOR /F "DELIMS=:\" %%A IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO CALL :SUB %%A
GOTO :EOF
:SUB
NET SHARE %1=%1: /GRANT:"Tout le monde",FULL

Note I've changed the possible drive letters output to exclude A: and B: drives.

Link to comment
Share on other sites

Thanks to all for your answer, if i use this code is it more correct ?

setlocal enabledelayedexpansion

for /F "tokens=1 delims=:\" %%A IN ('MOUNTVOL^|FINDSTR [A-Z]:\\') do (

set var=%%A

set var=!var: =!

net share !var!=!var!: /GRANT:"Tout le monde",FULL >NUL

endlocal

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...