Jump to content

Need a 3 choice cmd file


Recommended Posts

Ah then I think there is an issue. The folder was IN the same folder as the script

Just like I said ;)

Anyways I would like the iso the be put in the same dir as the source folder please

Inside it? Or in its parent folder? I mean, if the files are in c:\somewhere\XP (with i386 inside that), then you'd want the ISO to be c:\somewhere\XP.iso?

Link to comment
Share on other sites


Done:


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) & 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) & 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
valid=true
bootable=false
End If
End If
End Sub

Link to comment
Share on other sites

No do I have your permission to change any part of it (Like the Message areas) and redistribute?

It's 100% yours to do absolutely anything you want (released under the DontCareTM license*), no credits necessary or anything. It's just a small script.

Then again, I'd really double check the mkisofs options if I were you.

* Not an actual license. Lawyers didn't care enough to write it.

Link to comment
Share on other sites

When you are going to make a data disk and select no instead of gracefully exiting it opens the browse for folder dialog.

That's not a bug, it's a feature (where have I heard this before?)

That's in case you picked the wrong folder (wanting to select your XP CD) and mistakenly picked something else and don't want to burn that as a data disc, so it lets you select the folder again; clicking cancel will exit that.

Link to comment
Share on other sites

OK! One LAST request!

I made SEVERAL ISO's with it. and tried a vm of windows 2k and xp both went well.

I also compiled everthing into a neat, tiny little .exe. Special thanks to CoffeFiend included!

Attached is the resulting project. You run it and select the folder for ISO creation OR drag 'n drop a folder on it and it will do its thing.

I have VERY little knowledge of mkisofs commands so if anyone seees any improvements please let me know so I can call this final!

Commands called:

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 ""Windows"" -m thumbs.db -o " & chr(34) & 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"" -m thumbs.db -o " & chr(34) & src & ".iso" & chr(34) & " " & chr(34) & src & chr(34)
End If

Link to comment
Share on other sites

Sounds like a mission for jaclaz aka MSFN SuperB :ph34r:

WHO named my name vainly? :w00t:

(the actual guy who knows about this kind of things is cdob ;))

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"

Bootable:

"C:\whatever\path\to\mkisofs.exe" -v -iso-level 4 -l -D -d -J -joliet-long -r -volid "Title for Bootable" -A MKISOFS -sysid "Win32" -b bootsect.bin -no-emul-boot -boot-load-size 4 -allow-multidot -hide bootsect.bin -hide boot.catalog -o "whatever.iso" "c:\hic\sunt\leones\XP"

As I see it:

  • -relaxed-filenames has no meaning if -iso-level 4 and -J -joliet-long are set.
  • -duplicates-once ONLY has a meaning if making a multi-something-in-one AND if the version of mkisofs.exe supports them
  • AFAIK if you "hide" you also "hide-joliet"
  • the -r or -R adds Rockridge, the first with no special permission and the second with "elevated" root ones

Data:

"C:\whatever\path\to\mkisofs.exe" -v -iso-level 4 -l -D -d -J -joliet-long -r -volid "Title for Data" -A MKISOFS -sysid "Win32" -allow-multidot -o "whatever.iso" "c:\no\not_here\rather\there\or\better\elsewhere"

Please understand that -iso-level 4 is LATER than MSCDEX.EXE, so you will have problems in DOS unless you use SHSUCDX instead.

A setting of -iso-level 3 should be "enough" for the intended target. :unsure:

jaclaz

Link to comment
Share on other sites

I made a HTA for you to check out it has no code to make the ISO, but should give you a idea on how it would work.

MakeIsoGUI.png

Save As DemoMkIsoGui.hta


<TITLE>Make A Data Or Boot Iso</TITLE>
<HTA:APPLICATION ID='GUI_mkisofs'
Scroll='No'
SCROLLFLAT ='No'
SingleInstance='Yes'
SysMenu='Yes'
MaximizeButton='No'
MinimizeButton='Yes'
Border='Thin'
BORDERSTYLE ='complex'
INNERBORDER ='Yes'
Caption='Yes'
WindowState='Normal'
APPLICATIONNAME='mkisofs_GUI'
Icon='%SystemRoot%\explorer.exe'>
<!--
A Way To Dim Shl :Set Shl = CreateObject("Shell.Application")
Without Coding Any VBS Or JS Code
-->
<OBJECT ID="Shl" CLASSID="clsid:13709620-C279-11CE-A49E-444553540000"></OBJECT>
<STYLE Type='text/css'>
Body
{
Font-Size:10.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Lucida Console, Arial, Tahoma, Comic Sans MS;
Color:#203063;
BackGround-Color:Transparent;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#ece6e0',EndColorStr='#c0bab4');
Margin-Top:5;
Margin-Bottom:5;
Margin-Left:2;
Margin-Right:2;
Padding-Top:5;
Padding-Bottom:5;
Padding-Left:2;
Padding-Right:2;
Text-Align:Center;
Vertical-Align:Top;
Border-Top:1px Solid #dbd5d1;
Border-Bottom:2px Solid #c6c1ba;
Border-Left:1px Solid #c1bdb9;
Border-Right:2px Solid #d7d1cb;
}
BUTTON
{
Cursor:Hand;
Width:95pt;
Height:15pt;
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Lucida Console, Arial, Tahoma, Comic Sans MS;
Color:#001141;
Text-Align:Center;
Vertical-Align:Middle;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='AliceBlue',endColorStr='LightSlateGray');
Border-Top:0px Transparent;
Border-Bottom:0px Transparent;
Border-Left:0px Transparent;
Border-Right:0px Transparent;
Padding-Top:0;
Padding-Bottom:2;
Padding-Left:0;
Padding-Right:0;
Margin-Top:1;
Margin-Bottom:1;
Margin-Left:1;
Margin-Right:1;
BackGround-Color:Transparent;
}
.B1
{
Color:#004111;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#BAEABA',endColorStr='#226644');
}
TD.Txt1
{
Width:296pt;
Font-Size:9.05pt;
Font-Weight:Bold;
Color:#141414;
Font-Family:Lucida Console;
Padding-Left:1pt;
Padding-Right:1pt;
}
.Txt2
{
Width:311pt;
Font-Size:9.75pt;
Font-Weight:Bold;
Color:#004523;
Margin-Top:0;
Margin-Bottom:0;
Margin-Left:0;
Margin-Right:0;
Padding-Top:1;
Padding-Bottom:1;
Padding-Left:4;
Padding-Right:4;
}
.Txt3
{
Width:91pt;
Font-Size:9.05pt;
Font-Weight:Bold;
Color:#121212;
Padding-Left:4;
Padding-Right:4;
}
.TBox1
{
Font-Size:8.25pt;
Font-Weight:Bold;
Color:#1E1E1E;
Filter:Progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#faf6ef',EndColorStr='#efebe5');
Padding-top:1;
Padding-bottom:1;
Border-Top:1px Solid #cbc7c3;
Border-Bottom:2px Solid #a6a29e;
Border-Left:1px Solid #bcb8b4;
Border-Right:2px Solid #b2aeaa;
}
Table.T1
{
Margin-Top:0;
Margin-Bottom:0;
Margin-Left:0;
Margin-Right:0;
Padding-Top:1;
Padding-Bottom:1;
Padding-Left:5pt;
Padding-Right:5pt;
}
</STYLE>
<script LANGUAGE='VBScript'>
Const MyComp = &H11&
'-> Varibles For Runtime
Dim Boot, BurnIso, Fld, IsoChk, TxtMsg1
TxtMsg1="Select The Iso Source Folder , Or Press Cancel To Exit Script And Do Nothing"
'-> Resize And Move Window To Approx Center Screen
self.Focus
self.resizeTo 555,375
self.MoveTo screen.availWidth / 2 - 555/2,screen.availHeight / 2 - 375/2
'-> Add Coode To Check For Boot Bin And Other Files
Function Window_OnLoad()
End Function
'-> To Make Sure Only One Checkbox Get selected
Function CheckBoxReturns(Bt)
If Uc01.Checked = True And Uc02.Checked = False Then
Boot = Bt
Uc02.disabled = True
ElseIf Uc01.Checked = False And Uc02.Checked = False Then
Boot = ""
Uc01.disabled = False
Uc02.disabled = False
ElseIf Uc01.Checked = False And Uc02.Checked = True Then
Boot = Bt
Uc01.disabled = True
End If
End Function
'-> Brows For Dialog To Get Source And Output Folders
Function BrowsForFolder(Out)
Set Fld = Shl.BrowseForFolder( 0, TxtMsg1,16,MyComp)
If Fld Is Nothing Then
If Out = True Then Out = "Cancel At Adding Source FolderFor Iso Creation"
If Out = False Then Out = "Cancel At Adding Output For Folder Iso Creation"
alert(Out)
Exit Function
Else
If Out Then
IsoDir.value = Fld.Items.Item.Path
Else
IsoOut.value = Fld.Items.Item.Path
End If
End If
End Function
'-> Main Work Function Of The HTA
Function DoTheWork()
If Boot = "" Then
alert(vbtab & "Error 1" & vbcrlf & "Please Select Either The Data Or Boot Checkbox")
Else
If IsoDir.value = "" And IsoOut.value = "" Then
alert(vbtab & "Error 2" & vbcrlf & _
"Can Not Make The Iso Without A" & vbcrlf & _
"Source Folder And Output Folder")
ElseIf Len(IsoDir.value) =< 6 And IsoOut.value = "" Then
alert(vbtab & "Error 3" & vbcrlf & _
"The Source Folder Is Less Then 3 Characters" & vbcrlf & _
"The Output Folder Has Not Been Selected Yet")
IsoDir.value = ""
ElseIf Len(IsoDir.value) >= 6 And Len(IsoOut.value) =< 6 Then
alert(vbtab & "Error 4" & vbcrlf & _
"Source Folder " & vbtab & IsoDir.value & vbcrlf & _
"The Output Folder Is Less Then 3 Characters")
IsoOut.value = ""
ElseIf Len(IsoDir.value) >= 6 And Len(IsoOut.value) >= 6 Then
If Boot = True Then
CheckIsoNameLength(16)
Else
CheckIsoNameLength(32)
End If
'-> Passes Final Check
If IsoChk = True Then
'-> Confirm Start
If Confirm(vbtab & "Confirm Information" & vbcrlf & _
"Make Bootable Iso " & vbtab & Boot & vbcrlf & _
"Iso Source Folder " & vbtab & IsoDir.value & vbcrlf & _
"Iso Output Folder " & vbtab & IsoOut.value & vbcrlf & _
"Iso Image Name " & vbtab & BurnIso) Then
alert("Code Here To Start The Burning Process")
Else
'-> User Cancel Re Set All Varibles
alert("Re-Setting All Varibles Back To Nothing")
Boot = "" :IsoDir.value = "" :IsoOut.value = ""
BurnIso = "" :IsoChk = ""
Uc01.disabled = False
Uc02.disabled = False
End If
'-> Confirm End
Else
'-> Either Iso Name Was Blank Or It Exceeded Max Length
alert(vbtab & "Error 5" & vbcrlf & _
"The Name Is Either O Length Or Exceeds Max Characters." & vbcrlf & _
"If This Is A Data Name It Max Size Is 32 Characters" & vbcrlf & _
"If This Is A Boot Name It Max Size Is 16 Characters")
NamIso.value = ""
End If
End If
End If
End Function
'-> Check Length Make Sure It 1 Character Long And Under Max Characters
Function CheckIsoNameLength(Lgh)
If Len(NamIso.value) < Lgh And Len(NamIso.value) > 1 Then
IsoChk = True
BurnIso = NamIso.value
Else
IsoChk = False
End If
End Function
</SCRIPT>
<BODY Scroll='No'>Instructions On How Use
<!-- TEXT INFORMATION -->
<!-- 1 -->
<TABLE Border='1' Class='T1'><TD Class='Txt2'>
1:\ Press The Brows For Button, To Fill In Textbox 1 And 2
</TD></TABLE>
<!-- 2 -->
<TABLE Border='1' Class='T1'><TD Class='Txt2'>
2:\ Type In The Name For Your Iso In Textbox 3
</TD></TABLE>
<!-- 3 -->
<TABLE Border='1' Class='T1'><TD Class='Txt2'>
3:\ Select Either The Data Or Boot CheckBox
</TD></TABLE>
<!-- 3 -->
<TABLE Border='1' Class='T1'><TD Class='Txt2'>
4:\ Press The Build Iso Button To Make Your CD DVD
</TD></TABLE>
<!-- SOURCE FOLDER ISO -->
<TABLE Align='Center' Border='1'><TD Class='Txt3'>1:\ Iso Source Folder</TD><TD>
<INPUT Type='Text' ID='IsoDir' Class='TBox1' Size='44'>
</TD></TABLE>
<!-- OUTPUT FOLDER ISO -->
<TABLE Align='Center' Border='1'><TD Class='Txt3'>2:\ Iso Output Folder</TD><TD>
<INPUT Type='Text' ID='IsoOut' Class='TBox1' Size='44'>
</TD></TABLE>
<!-- NAME ISO -->
<TABLE Align='Center' Border='1'><TD Class='Txt3'>3:\ Iso Image Name</TD><TD>
<INPUT Type='Text' ID='NamIso' Class='TBox1' Size='44'>
</TD></TABLE>
<!-- DATA ISO -->
<TABLE Style='Text-Align:Center;' Border='1'><TD>
<INPUT Type='CheckBox' ID='Uc01' Name='Uc01'OnClick='CheckBoxReturns(False)'></TD>
<TD Class='Txt1'>Data ISO, For CD/DVD Music, Backup, Storage</TD></TABLE>
<!-- BOOTABLE ISO -->
<TABLE Style='Text-Align:Center;' Border='1'><TD>
<INPUT Type='CheckBox' ID='Uc02' Name='Uc02' OnClick='CheckBoxReturns(True)'></TD>
<TD Class='Txt1'>Boot ISO, For Installing Or Repairing An Os</TD></TABLE>
<!-- START BUTTON CONTAINER -->
<TABLE Border='1' Style='Width:323pt;Text-Align:Center;'><TD>
<!-- INLINE SCRIPTING -->
<BUTTON ID='Btn01'
OnClick="
If Btn01.innerHTML = 'Brows For Source Iso' Then
TxtMsg1 = TxtMsg1
BrowsForFolder(True)
Btn01.innerHTML = 'Brows For Output Iso'
Else
TxtMsg1 = Replace(TxtMsg1,'Source','Output')
BrowsForFolder(False)
Btn01.innerHTML = 'Brows For Source Iso'
End If
">Brows For Source Iso</BUTTON>
<!-- Build Iso Button -->
<BUTTON ID='Btn02' OnClick="DoTheWork()">Build Iso</BUTTON>
<!-- Close Button -->
<BUTTON ID='Btn03' OnClick="window.close">Close</BUTTON>
</TD></TABLE>
<!-- END BUTTON CONTAINER -->
</BODY>

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