Jump to content

Need a 3 choice cmd file


Recommended Posts


DOS or console inside 2K, XP etc.?

If the latter (if you want a "cmd"....:whistle:) ;):

:loop
ECHO 1 = Run app
ECHO 2 = Run app w\switch /B
ECHO 3 = Exit.

SET /P Mychoice=Please input a number
IF %Mychoice%.==1. GOTO :Run_app_1
IF %Mychoice%.==2. GOTO :Run_app_2
IF %Mychoice%.==3. GOTO :just_exit
CLS&GOTO :loop

:Run_app_1
ECHO This is Run_app_1
GOTO :EOF

:Run_app_2
ECHO This is Run_app_2
GOTO :EOF

:just_exit
ECHO This is just_exit
GOTO :EOF

OR:

:loop
ECHO 1 = Run app
ECHO 2 = Run app w\switch /B
ECHO 3 = Exit.

SET /P MyChoice=Please input a number
FOR /L %%A IN (1,1,3) DO IF "%%A"=="%Mychoice%" GOTO :Choice_%MyChoice%
CLS&GOTO :loop

:Choice_1
ECHO This is Choice_1
GOTO :EOF

:Choice_2
ECHO This is Choice_2
GOTO :EOF

:Choice_3
ECHO This is Choice_3
GOTO :EOF

Link to comment
Share on other sites

Here is my effort at a cmd with choice


@Echo Off

:Main
CLS && Color A9 && Title Main Menu && Mode 65, 9
Echo.
Echo Press 1 to install app no switches
Echo Press 2 to install app /swiches
Echo Press 3 to exit
Echo.

SET Choice=
SET /P Choice= Type Either 1 Or 2 Or 3 ^>^

IF /I '%Choice%'=='1' GOTO 1
IF /I '%Choice%'=='2' GOTO 2
IF /I '%Choice%'=='3' GOTO 3

::Incase The Input Was Wrong
CLS && Color 9b && Title Invalid Choice && mode 65,7
ECHO.
ECHO This reply %Choice% is not valid. Please try again.
ECHO.
ping -n 3 127.0.0.1>nul
GOTO Main

:: Choice 1
:1
CLS && Color F9 && Title Choice 1 Selected && mode 65,7
Echo.
Echo This will self close in 3 seconds
Echo.
ping -n 3 127.0.0.1>nul | set /p = Press Enter To Close
Goto :End

:: Choice 2
:2
CLS && Color F8 && Title Choice 2 Selected && mode 65,7
Echo.
Echo This will self close in 3 seconds
Echo.
ping -n 3 127.0.0.1>nul | set /p = Press Enter To Close
Goto :End

:: Choice 3
:3
CLS && Color F8 && Title Choice 3 Selected && mode 65,7
Echo.
Echo This will self close in 3 seconds
Echo.
ping -n 3 127.0.0.1>nul | set /p = Press Enter To Close
Goto :End

:End
Exit

Link to comment
Share on other sites

Well sh*t on me...

HEY Thanks guys!

Here is the finished product!

It is a Tiny SendTo addition to make Either DATA iso's from a folder or Bootable ISO's for Win2k, WinXP and Win2k3 (vbs by dumpy dooby)

It is also uninstallable!

Size - 264kb MD5 = e32f361b5836a2ecbedd96b5c6711a2d

Edited by Kelsenellenelvian
Link to comment
Share on other sites

I am missing the reason for the LCISOcreator.exe. :unsure:

A batch to launch a .vbs that launches mkisofs.exe....:w00t:

You could also add a .hta in the middle (just for the fun of it):

http://mysite.verizon.net/hartsec/make.htm

Or a Auto-it tool:

http://www.solriche.co.uk/files/mgiso/mgiso.htm

Seriously, you could ask, say, gunsmokingman to add the choices to the .vbs (and also remove the unneeded parts, getting rid of the batch) or, say, Yzöwl to add the mkisofs commands inside the batch (and get rid of the .vbs),right now there is an unneeded complication, as I see it.

jaclaz

Link to comment
Share on other sites

jaclaz

Seriously, you could ask, say, gunsmokingman to add the choices

Vbs Code For Drap Drop Folder Or Open a Brows for Dialog, all that is needed

is the code to make the iso.


Const MyComp = &H11&
Dim Boot, IsoFolder, Obj, Var
If Wscript.Arguments.Count = 1 Then
For Each Obj In WScript.Arguments
If Right(InStr(Obj,"."),4) Or Right(InStr(Obj,"."),5) Then
WScript.Echo "Error This Is Only For Folders Only"
Else
UserSelection(Obj)
End If
Next
Else
ManualSelectFolder()
End If
'-> Confirm Folder Path And Boot Or Data Iso
Function ConfirmIt()
If MsgBox("Is This The Correct Folder Path And Swich" & vbCrLf & IsoFolder,4132, "Results") = 6 Then
If Boot Then
MsgBox "Place Code To Make Boot Iso" & vbCrLf & "Bootable = " & Boot
Else
MsgBox "Place Code To Make Data Iso" & vbCrLf & "Bootable = " & Boot
End If
Else
ManualSelectFolder()
End If
End function
'-> User Choice Boot Data Quit
Function UserSelection(Obj)
Var = MsgBox( _
vbTab & "Make Iso Instructions" & vbCrLf & _
"Press Yes To Make A Bootable Iso" & vbCrLf & _
"Press No To Make A Data Iso" & vbCrLf & _
"Press Cancel To Exit Script" & vbCrLf & _
Obj, 4131,"Make Iso")
If Var = 2 Then
MsgBox "User Cancel Iso Creation", 4128,"Cancel Iso"
WScript.Quit(0)
ElseIf Var = 6 Then
IsoFolder = Obj
Boot = True
ElseIf Var = 7 Then
IsoFolder = Obj
Boot = False
End If
ConfirmIt()
End Function
'-> Open A Brows For Folder Dialog
Function ManualSelectFolder()
Dim Shl :Set Shl = CreateObject("Shell.Application")
Dim Fld :Set Fld = Shl.BrowseForFolder( _
0, "Select The Iso Source Folder, Or Press Cancel To Exit Script And Do Nothing",16,MyComp)
If Fld Is Nothing Then
MsgBox "User Cancel Manual Add Folder",4128,"User Cancel"
WScript.Quit(1)
Else
UserSelection(Fld.Items.Item.Path)
End If
End Function

Link to comment
Share on other sites

jaclaz

Seriously, you could ask, say, gunsmokingman to add the choices

Vbs Code For Drap Drop Folder Or Open a Brows for Dialog, all that is needed

is the code to make the iso.


Const MyComp = &H11&
Dim Boot, IsoFolder, Obj, Var
If Wscript.Arguments.Count = 1 Then
For Each Obj In WScript.Arguments
If Right(InStr(Obj,"."),4) Or Right(InStr(Obj,"."),5) Then
WScript.Echo "Error This Is Only For Folders Only"
Else
UserSelection(Obj)
End If
Next
Else
ManualSelectFolder()
End If
'-> Confirm Folder Path And Boot Or Data Iso
Function ConfirmIt()
If MsgBox("Is This The Correct Folder Path And Swich" & vbCrLf & IsoFolder,4132, "Results") = 6 Then
If Boot Then
MsgBox "Place Code To Make Boot Iso" & vbCrLf & "Bootable = " & Boot
Else
MsgBox "Place Code To Make Data Iso" & vbCrLf & "Bootable = " & Boot
End If
Else
ManualSelectFolder()
End If
End function
'-> User Choice Boot Data Quit
Function UserSelection(Obj)
Var = MsgBox( _
vbTab & "Make Iso Instructions" & vbCrLf & _
"Press Yes To Make A Bootable Iso" & vbCrLf & _
"Press No To Make A Data Iso" & vbCrLf & _
"Press Cancel To Exit Script" & vbCrLf & _
Obj, 4131,"Make Iso")
If Var = 2 Then
MsgBox "User Cancel Iso Creation", 4128,"Cancel Iso"
WScript.Quit(0)
ElseIf Var = 6 Then
IsoFolder = Obj
Boot = True
ElseIf Var = 7 Then
IsoFolder = Obj
Boot = False
End If
ConfirmIt()
End Function
'-> Open A Brows For Folder Dialog
Function ManualSelectFolder()
Dim Shl :Set Shl = CreateObject("Shell.Application")
Dim Fld :Set Fld = Shl.BrowseForFolder( _
0, "Select The Iso Source Folder, Or Press Cancel To Exit Script And Do Nothing",16,MyComp)
If Fld Is Nothing Then
MsgBox "User Cancel Manual Add Folder",4128,"User Cancel"
WScript.Quit(1)
Else
UserSelection(Fld.Items.Item.Path)
End If
End Function

OK now this is awesome!

What all code is needed from the previous makeiso.vbs?

I mean I can add it all together but from previous posts and reading your script there is ALOT of waste in there.

Can you cleanup and combine the old code and your code?

Herte is the old code to make it easier on you:


Option Explicit
Dim fs, ws, arg, mypath, bootable, source, destination, label, mchar, params, LogFile
Set fs = CreateObject("Scripting.FileSystemObject")
Set ws = WScript.CreateObject("WScript.Shell")
bootable = False
mchar = 32
source = False
mypath = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - ( Len(WScript.ScriptName) + 1 ) )
Set LogFile = fs.OpenTextFile(mypath & "\log.txt",8,True,0)

If WScript.Arguments.Count <> 0 Then
For each arg in WScript.Arguments
If Left(LCase(arg),2) = "/b" Or Left(LCase(arg),2) = "-b" Then
bootable = True : mchar = 16
ElseIf fs.FolderExists(arg) Then
source = fs.GetAbsolutePathName(arg)
ElseIf fs.FileExists(arg) Then
source = fs.GetAbsolutePathName(fs.GetParentFolder(arg))
ElseIf Right(arg,2) = ":\" Then
LogFile.WriteLine(Date & " " & Time & " - Launching: " & mypath & "\LCISOCreator.exe")
ws.Run Chr(34) & mypath & "\LCISOCreator.exe" & Chr(34) , 1 , False
WScript.Quit
Else
WScript.Echo "Invalid argument <" & arg & ">"
LogFile.WriteLine(Date & " " & Time & " - Non-Fatal Error: Invalid argument. <" & arg & ">")
End If
Next
End If

If Not VarType(source) = 8 Then
WScript.Echo "Source folder not specified!"
LogFile.WriteLine(Date & " " & Time & " - Fatal Error: Source folder not specified!")
WScript.Quit
End If

ws.CurrentDirectory = source
label = fs.GetFileName(source)

Do
If Len(label) > mchar Then
If LCase(Right(WScript.FullName,12)) = "\cscript.exe" Then
WScript.StdOut.Write VBCrLf & " Please enter a label for the ISO." & VBCrLf & " Label cannot be longer than " & mchar & " characters." & VBCrLf & VBCrLf & " >"
label = WScript.StdIn.ReadLine
Else
label = InputBox("Please enter a label for the ISO." & VBCrLf & "Label canot be longer than " & mchar & " characters.")
End If
Else
Exit Do
End If
If IsEmpty(label) Then label = " "
Loop

params = " -iso-level 2 -J -joliet-long -l -D -relaxed-filenames -N -V " & Chr(34) & label & Chr(34) & " -v -x thumbs.db -o ..\" & fs.GetBaseName(source) & ".iso ."
If bootable Then
If fs.FileExists(mypath & "\xpBoot.img") Then
fs.CopyFile mypath & "\xpBoot.img", source & "\"
Else
WScript.Echo "Error! Cannot create bootable XP disc without XP boot image! <xpBoot.img>"
LogFile.WriteLine(Date & " " & Time & " - Non-Fatal Error: Bootable discs cannot be created without a proper boot image.")
LogFile.WriteLine(Date & " " & Time & " - The script will still attempt to execute on the chance that the image is present in the source directory.")
End If
params = " -b " & Chr(34) & "xpBoot.img" & Chr(34) & " -iso-level 2 -relaxed-filenames -joliet-long -N -d -duplicates-once -D -boot-load-seg 0x7C0 -boot-load-size 4 -hide xpBoot.img -hide boot.catalog -J -hide-joliet xpBoot.img -hide-joliet boot.catalog -no-emul-boot -volid " & Chr(34) & label & Chr(34) & " -sysid " & Chr(34) & "Win32" & Chr(34) & " -v -x thumbs.db -o ..\" & fs.GetBaseName(source) & ".iso ."
End If

ws.Run Chr(34) & mypath & "\mkisofs.exe" & Chr(34) & params , 10 , True
LogFile.WriteLine(Date & " " & Time & " - Command Executed: " & Chr(34) & mypath & "\mkisofs.exe" & Chr(34) & params)
If fs.FileExists(source & "\xpBoot.img") Then fs.DeleteFile source & "\xpBoot.img", True
WScript.Quit

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

If no can you remove the relevant code?

Edited by Kelsenellenelvian
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...