Jump to content

Need a 3 choice cmd file


Recommended Posts

Why not just one one of the countless mkisofs frontends out there such as this one (open source, autoit; there's plenty of others too, and in pretty much any language you could ask for)? Isn't that what you're looking for (instead of stringing bits & pieces of 3 so-so scripts together)?

Also this "LCISOcreator.exe" is this part even needed?

Only if you want that particular app started when someone passes a drive name as an argument (it's meant to create ISOs from a disc in the said drive -- not that it even checks if it's a CD/DVD drive though)

Link to comment
Share on other sites


I am looking for something I can distribute

You can do that with a number of those frontends -- pretty much all those who are open source (like the one I linked to, which was the first hit using Google)

has to be really small

Most of the space will be taken by mkisofs in most cases ;)

and must be super id*** proof in the end. (Hence the 3 choices only)

That can be done fairly easily...

Anyhow. Writing such a script (or a HTA or whatever else) is really simple and quick. The main "hurdle" is knowing where you expect things like the bootsector to be stored (AFAIK you can't legally redistribute this either), and any particular tweaks/settings you'd like to use for mkisofs (if any).

Link to comment
Share on other sites

The main "hurdle" is knowing where you expect things like the bootsector to be stored (AFAIK you can't legally redistribute this either)

There is no need to redistribute the bootsector. It's stored inside spcmdcon.sys.

Search for 0xfa 0x33 0xc0 0x8e second match and extract 2048 bytes.

Link to comment
Share on other sites

There is no need to redistribute the bootsector. It's stored inside spcmdcon.sys.

Search for 0xfa 0x33 0xc0 0x8e second match and extract 2048 bytes.

That would be an option.

Anyhow. Here's a quick & dirty VBScript that creates a bootable XP ISO, taking the path as it's only argument (it asks for it if it's invalid or not provided). It should do the trick.

The CD is bootable and the files are added (that much is tested) but you *may* have to tweak msisofs' options (haven't actually checked if the whole install runs fine). If that helps, here's the list of cmd line args for mkisofs. Again, very little testing has been done as far as that part is concerned (one VM boots to the CD and that's about it). Feel free to rename the bootsector to whatever you wish instead of bootsect.bin...


Option Explicit
Const bootsect = "bootsect.bin"
Dim fso, wsh, shl, fld, src, locpath, valid

Set fso = CreateObject("Scripting.FileSystemObject")
Set wsh = WScript.CreateObject("WScript.Shell")
locpath=Left(WScript.ScriptFullName,(Len(WScript.ScriptFullName)-Len(Wscript.ScriptName)))
If Not fso.FileExists(locpath & "mkisofs.exe") Then
MsgBox "mkiofs.exe missing", 16, "Error" 'vbOKOnly=0 vbCritical=16
WScript.Quit(1)
End If
valid = false
If WScript.Arguments.Count = 1 Then
src=WScript.Arguments(0)
ValidateSourcePath()
End If
If Not valid Then
Set shl=CreateObject("Shell.Application")
While Not valid
Set fld=shl.BrowseForFolder(0, "Select source",16,17) '16=BIF_EDITBOX; 17=ssfDRIVES
If fld Is Nothing Then WScript.Quit(1)
src=fld.Self.Path
Set fld=Nothing
ValidateSourcePath()
Wend
Set shl=Nothing
End If
If Not fso.FileExists(src & "\" & bootsect) Then
If Not fso.FileExists(locpath & "\" & bootsect) Then
MsgBox "Boot sector missing (" & bootsect & ")", 16, "Error"
WScript.Quit(1)
Else
fso.CopyFile locpath & bootsect, src & "\"
End If
End If
wsh.Run chr(34) & locpath & "\mkisofs.exe" & chr(34) & " -b " & chr(34) & bootsect & chr(34) & _
" -no-emul-boot -boot-load-seg 0x7C0 -boot-load-size 4 -hide " & _
chr(34) & bootsect & chr(34) & " -hide-joliet " & chr(34) & bootsect & chr(34) & _
" -hide boot.catalog -hide-joliet boot.catalog -relaxed-filenames -duplicates-once -iso-level 4 -J -l -joliet-long -allow-multidot " & _
"-sysid ""Win32"" -V ""WinXP"" -m thumbs.db -o " & chr(34) & fso.GetBaseName(src) & ".iso" & chr(34) & " " & chr(34) & src & chr(34)

Sub ValidateSourcePath()
If fso.FileExists(src) Then src=fso.GetParentFolderName(src)
If Not fso.FolderExists(src & "\i386") Then Exit Sub
valid = true
End Sub

Any changes you need, different language preferred, different mkisofs options, ... Whatever it is, just ask.

Link to comment
Share on other sites

Hmmm it loops at the browse for folder section.

Is it really a XP CD you're browsing for? It tests to see if a i386 subfolder is in there. It could check for something else if you wanted, or blindly create it disregarding if it contains anything relevant.

Link to comment
Share on other sites

Can you add option 2 for data iso's also?

How about when it sees it's not a XP CD (no i386 subdir), it warns you and asks if you'd like to create a data CD instead (messagebox with yes/no btns)? There really isn't a great way to make "menus" using VBScript (the console input methods suck pretty darn badly; for starters, there's nothing in vbscript quite like _getch in C++/ReadKey in C#/choice.com in batch or whatever you'd want to call that) so you'd be looking at using a completely different language instead...

Link to comment
Share on other sites

Ok, just a quick change to see if it behaves like you want it to:


Option Explicit
Const bootsect = "bootsect.bin"
Dim fso, wsh, shl, fld, src, locpath, valid, bootable

Set fso = CreateObject("Scripting.FileSystemObject")
Set wsh = WScript.CreateObject("WScript.Shell")
locpath=Left(WScript.ScriptFullName,(Len(WScript.ScriptFullName)-Len(Wscript.ScriptName)))
If Not fso.FileExists(locpath & "mkisofs.exe") Then
MsgBox "mkiofs.exe missing", 16, "Error" 'vbOKOnly=0 vbCritical=16
WScript.Quit(1)
End If
valid=false
bootable=false
If WScript.Arguments.Count = 1 Then
src=WScript.Arguments(0)
ValidateSourcePath()
End If
If Not valid Then
Set shl=CreateObject("Shell.Application")
While Not valid
Set fld=shl.BrowseForFolder(0, "Select source",16,17) '16=BIF_EDITBOX; 17=ssfDRIVES
If fld Is Nothing Then WScript.Quit(1)
src=fld.Self.Path
Set fld=Nothing
ValidateSourcePath()
Wend
Set shl=Nothing
End If
If bootable And Not fso.FileExists(src & "\" & bootsect) Then
If Not fso.FileExists(locpath & "\" & bootsect) Then
MsgBox "Boot sector missing (" & bootsect & ")", 16, "Error"
WScript.Quit(1)
Else
fso.CopyFile locpath & bootsect, src & "\"
End If
End If
If bootable Then
wsh.Run chr(34) & locpath & "\mkisofs.exe" & chr(34) & " -b " & chr(34) & bootsect & chr(34) & _
" -no-emul-boot -boot-load-seg 0x7C0 -boot-load-size 4 -hide " & _
chr(34) & bootsect & chr(34) & " -hide-joliet " & chr(34) & bootsect & chr(34) & _
" -hide boot.catalog -hide-joliet boot.catalog -relaxed-filenames -duplicates-once -iso-level 4 -J -l -joliet-long -allow-multidot " & _
"-sysid ""Win32"" -V ""WinXP"" -m thumbs.db -o " & chr(34) & fso.GetBaseName(src) & ".iso" & chr(34) & " " & chr(34) & src & chr(34)
Else
wsh.Run chr(34) & locpath & "\mkisofs.exe" & chr(34) & " -relaxed-filenames -duplicates-once -iso-level 4 -J -l -joliet-long -allow-multidot " & _
"-sysid ""Win32"" -V ""Data Disc"" -m thumbs.db -o " & chr(34) & fso.GetBaseName(src) & ".iso" & chr(34) & " " & chr(34) & src & chr(34)
End If

Sub ValidateSourcePath()
If fso.FileExists(src) Then src=fso.GetParentFolderName(src)
If Not fso.FolderExists(src) Then Exit Sub
If fso.FolderExists(src & "\i386") Then
valid=true
bootable=true
Else
If MsgBox("The specified folder doesn't contain Windows XP" & chr(13) & chr(10) & "Create a data CD instead?", 36, "Warning") = 6 Then 'vbYesNo=4 vbQuestion=32 vbYes=6
valid=true
bootable=false
End If
End If
End Sub

Again, I can't vouch for the specific mkisofs options, I'll let you test that stuff ;) If you want to change anything else like where the ISO gets created just let me know.

Link to comment
Share on other sites

That seemed to work properly except I cannot find the .iso :S

Right now, it gets created wherever you've put the vbscript. Like my previous post says, just let me know where you want it.

Also it suggested adding rock ridge to the parameters.

I'll wait for a list of known working mkiofs parameters to update that ;)

Right now it runs either:

"C:\whatever\path\to\mkisofs.exe" -b "bootsect.bin" -no-emul-boot -boot-load-seg 0x7C0 -boot-load-size 4 -hide "bootsect.bin" -hide-joliet "bootsect.bin" -hide boot.catalog -hide-joliet boot.catalog -relaxed-filenames -duplicates-once -iso-level 4 -J -l -joliet-long -allow-multidot -sysid "Win32" -V "WinXP" -m thumbs.db -o "whatever.iso" "c:\here\be\dragons\XP"

for a bootable XP CD, or for a data CD:

"C:\whatever\path\to\mkisofs.exe" -relaxed-filenames -duplicates-once -iso-level 4 -J -l -joliet-long -allow-multidot -sysid "Win32" -V "Data Disc" -m thumbs.db -o "whatever.iso" "c:\somewhere\here\there\no\over\here\or\whatever"

You can try to sort those from a command line perhaps. Find out what works.

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