[2008] Problems launching mkisofs.exe with parameters
I'm trying to incorporate an ISO creation function within my app. It's purely for creating dvd-video compliant ISO images.
I'm using the open source mkisofs.exe (with cygwin1.dll). The full command should be:-
mkisofs.exe -dvd-video -o <isoimagename.iso> <directory with video files>
e.g.
mkisofs.exe -dvd-video -o "c:\isoimages\test.iso" "c:\dvd files\my movie"
I've tried various ways of calling this, but each time I do, a command prompt windows appears and in a split second disappears again, and I don't know why!
ALSO, while on the subject, if I can get that bit working, then mkisofs.exe outputs a percentage complete as it goes through the process - I'd like to redirect that output back to my application so that I can incorporate a progress bar....
Can anyone help?
Re: [2008] Problems launching mkisofs.exe with parameters
You use Process.Start to start a new process. Read the documentation and it will tell you how to pass arguments on the commandline of the EXE you run.
There's a submission in the VB.NET CodeBank forum on redirecting command prompt output that will sort out your last question.
Re: [2008] Problems launching mkisofs.exe with parameters
Well, I am getting no closer. This is the code I have. The CMD window opens and nothing happens after that...
vb.net Code:
Private Results As String
Private Delegate Sub delUpdate()
Private Finished As New delUpdate(AddressOf UpdateText)
Private Sub UpdateText()
txtResults.Text = Results
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim CMDThread As New Threading.Thread(AddressOf CMDAutomate)
CMDThread.Start()
End Sub
Private Sub CMDAutomate()
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
StartInfo.FileName = "cmd" 'starts cmd window
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False 'required to redirect
StartInfo.CreateNoWindow = False 'True 'creates no cmd window
myprocess.StartInfo = StartInfo
myprocess.Start()
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput
SW.WriteLine(Convert.ToChar(34) & System.Windows.Forms.Application.StartupPath & "\mkisofs.exe" & Convert.ToChar(34) & " -dvd-video -o " & Convert.ToChar(34) & "S:\Converted DVDs\test.iso" & Convert.ToChar(34) & " " & Convert.ToChar(34) & "S:\Converted DVDs\crystal-wwcs" & Convert.ToChar(34)) 'the command you wish to run.....
SW.WriteLine("exit") 'exits command prompt window
Results = SR.ReadToEnd 'returns results of the command window
SW.Close()
SR.Close()
'invokes Finished delegate, which updates textbox with the results text
Invoke(Finished)
End Sub
For info, I have uploaded mkisofs.exe with cygwin1.dll to http://www.cgeuk.com/mkisofs.zip
Re: [2008] Problems launching mkisofs.exe with parameters
have you tried
Code:
Process.start("mkisofs.exe", "-dvd-video -o ""c:\isoimages\test.iso"" ""c:\dvd files\my movie"" ")
Re: [2008] Problems launching mkisofs.exe with parameters
as far as your code is concer you are only calling cmd in your process..
Code:
StartInfo.FileName = "cmd"
.....
myprocess.Start()
Re: [2008] Problems launching mkisofs.exe with parameters
I'm just kicking off a batch file and passing parameters, but had the same issue, the DOS box would flash, then go away. This didn't occur all the time so I knew the batch was good. The problem was having spaces in the path.
Your path " "c:\dvd files\my movie"" has a space between "my" and "movie". Remove the space and try again.
Good luck
Re: [2008] Problems launching mkisofs.exe with parameters
Quote:
Originally Posted by McDuff
I'm just kicking off a batch file and passing parameters, but had the same issue, the DOS box would flash, then go away. This didn't occur all the time so I knew the batch was good. The problem was having spaces in the path.
Your path " "c:\dvd files\my movie"" has a space between "my" and "movie". Remove the space and try again.
Good luck
I had already taken the spaces out - for example I changed "Converted DVDs" to "conver~1" and that made no difference...
Re: [2008] Problems launching mkisofs.exe with parameters
Quote:
Originally Posted by riteshjain1982
have you tried
Code:
Process.start("mkisofs.exe", "-dvd-video -o ""c:\isoimages\test.iso"" ""c:\dvd files\my movie"" ")
Yes - and it doesn't work I'm afraid....
Quote:
Originally Posted by riteshjain1982
as far as your code is concer you are only calling cmd in your process..
Code:
StartInfo.FileName = "cmd"
.....
myprocess.Start()
Yes - but the SW.WriteLine is supposed to send the mkisofs.exe command, and when finished, the exit command - and the output of the cmd window is to be returned back to my app...