I have a program I am using to select a file and pad the file (binary file) to a specific size. I use the process.start command to kick off a batch file to start the padding of the file specified.
If I launch the batch file from the vb.net form the process never exits. It does pad the file to the specified size, but never exits. starting the batch file from the actual command prompt works with no issue. Depending on the size of the padding will can take longer, so 16k will take longer than 8k, etc.
Any help would be appreciated.
I have the padding file process in a module as follows:
one of the batch files is below:
If I launch the batch file from the vb.net form the process never exits. It does pad the file to the specified size, but never exits. starting the batch file from the actual command prompt works with no issue. Depending on the size of the padding will can take longer, so 16k will take longer than 8k, etc.
Any help would be appreciated.
I have the padding file process in a module as follows:
Code:
Sub padfile()
' One file parameter to the executable
Dim blnValue, permanent As Boolean
Dim intResponse As Integer
Dim proc As New Process
Dim sourceName As String = Form1.ListView2.FocusedItem.SubItems(0).Text
' The second file parameter to the executable
Dim c1 As String = Form1.cmbpad.Text & ".bat"
Dim filetopad As String = " " & Form1.txtpaddir.Text & "\" & sourceName
permanent = True
intResponse = MsgBox("PAD Selected File?", vbYesNo)
If intResponse = vbYes Then
blnValue = True
Else
blnValue = False
End If
If blnValue = True Then
proc.StartInfo.UseShellExecute = False
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.CreateNoWindow = True 'Dont show the cmd window when the program is running
proc.StartInfo.FileName = "cmd.exe"
proc.StartInfo.Arguments = " " + If(permanent = True, "/K", "/C") + " " + c1 & filetopad
proc.Start()
Form1.lblpading.Visible = True
proc.WaitForExit()
End If
Module1.Refresh2()
End Sub
one of the batch files is below:
Code:
@echo off
:top
if %~z1 GEQ 8192 goto :eof
copy /y %1 /b + nul /a %1 > nul
goto top