B
Bruce W. Darby
This will be my very first VB.Net application and it's pretty simple. But
I've got a snag in my syntax somewhere. Was hoping that someone could point
me in the right direction.
The history:
My work involves creating custom packages of our software product for golf
courses that purchase our software. The course data is kept as a back up in
the event the course needs us to replace their custom files. Each course has
a folder of it's own data under a centralized directory.
The problem:
The custom files are going to become a serious storage issue as our customer
base increases.
The solution:
Compress each course folder into an individual .cab file containing all of
the course's custom files and then archive these files to storage media such
as CD/DVD.
Where I need help:
I found some code for implementing a command line window and passing it a
string through a stream. The command window is being instantiated, but the
string is not getting passed or my syntax for running the makecab utility is
off-base. I've spent several hours looking for sample code that would
explain the makecab syntax and I've also tried to determine if the
parameters are being passed in to the Sub correctly. I've set a break at the
line where the string should be passed to the command window, but I can not
seem to get a respnse from the watches that have been set. I've included a
copy of the sub that I'm using to compress the files. If this is not the
correct forum for this, I do apologize. A nudge in the correct direction
would be deeply appreciated.
Private Sub CompressFolder(ByVal ToFolder As String, ByVal FromFolder As
String, ByVal FinalFile As String)
Dim CompressProcess As Process = New Process
CompressProcess.StartInfo.FileName = "cmd.exe"
CompressProcess.StartInfo.UseShellExecute = False
CompressProcess.StartInfo.CreateNoWindow = True
CompressProcess.StartInfo.RedirectStandardInput = True
CompressProcess.StartInfo.RedirectStandardOutput = True
CompressProcess.StartInfo.RedirectStandardError = True
CompressProcess.Start()
Dim stmStreamIn As IO.StreamWriter = CompressProcess.StandardInput
stmStreamIn.AutoFlush = True
Dim stmStreamOut As IO.StreamReader = CompressProcess.StandardOutput
Dim stmStreamErr As IO.StreamReader = CompressProcess.StandardError
stmStreamIn.Write("makecab.exe /L %ToFolder% %FromFolder% %FinalFile%" &
System.Environment.NewLine)
stmStreamIn.Write("exit" & System.Environment.NewLine)
If Not CompressProcess.HasExited Then
CompressProcess.Kill()
End If
stmStreamIn.Close()
stmStreamOut.Close()
stmStreamErr.Close()
End Sub
I've got a snag in my syntax somewhere. Was hoping that someone could point
me in the right direction.
The history:
My work involves creating custom packages of our software product for golf
courses that purchase our software. The course data is kept as a back up in
the event the course needs us to replace their custom files. Each course has
a folder of it's own data under a centralized directory.
The problem:
The custom files are going to become a serious storage issue as our customer
base increases.
The solution:
Compress each course folder into an individual .cab file containing all of
the course's custom files and then archive these files to storage media such
as CD/DVD.
Where I need help:
I found some code for implementing a command line window and passing it a
string through a stream. The command window is being instantiated, but the
string is not getting passed or my syntax for running the makecab utility is
off-base. I've spent several hours looking for sample code that would
explain the makecab syntax and I've also tried to determine if the
parameters are being passed in to the Sub correctly. I've set a break at the
line where the string should be passed to the command window, but I can not
seem to get a respnse from the watches that have been set. I've included a
copy of the sub that I'm using to compress the files. If this is not the
correct forum for this, I do apologize. A nudge in the correct direction
would be deeply appreciated.
Private Sub CompressFolder(ByVal ToFolder As String, ByVal FromFolder As
String, ByVal FinalFile As String)
Dim CompressProcess As Process = New Process
CompressProcess.StartInfo.FileName = "cmd.exe"
CompressProcess.StartInfo.UseShellExecute = False
CompressProcess.StartInfo.CreateNoWindow = True
CompressProcess.StartInfo.RedirectStandardInput = True
CompressProcess.StartInfo.RedirectStandardOutput = True
CompressProcess.StartInfo.RedirectStandardError = True
CompressProcess.Start()
Dim stmStreamIn As IO.StreamWriter = CompressProcess.StandardInput
stmStreamIn.AutoFlush = True
Dim stmStreamOut As IO.StreamReader = CompressProcess.StandardOutput
Dim stmStreamErr As IO.StreamReader = CompressProcess.StandardError
stmStreamIn.Write("makecab.exe /L %ToFolder% %FromFolder% %FinalFile%" &
System.Environment.NewLine)
stmStreamIn.Write("exit" & System.Environment.NewLine)
If Not CompressProcess.HasExited Then
CompressProcess.Kill()
End If
stmStreamIn.Close()
stmStreamOut.Close()
stmStreamErr.Close()
End Sub