I am trying to compress folders in a directory using 7-zip command line, but the 7-zip command line execution is not continuing until I manually click on close button because of a warning with some file (WARNING: The process cannot access the file because it is being used by another process).
There are lot of files and error can occur on different file each time. I have looking into the command line help document seems it there are no arguments for ignore warning messages and continue job.
I want to ignore errors/ warning while compressing process. Is there any arguments for ignore that warning/ error and continue?
Here is my code
For Each source In System.IO.Directory.GetDirectories("C:\Users\hacker\AppData\Local\Google\Chrome\User Data\Default")
Try
Dim pInfo As New ProcessStartInfo()
pInfo.FileName = "C:\Program Files\7-Zip\7zG.exe" '//zip process continuing when i use 7z.exe here
pInfo.Arguments = "a -t7z " & destination & ".7z" & ControlChars.Quote & source & ControlChars.Quote & " -mx=3"
Dim p As New Process()
p.StartInfo = pInfo
p.Start()
p.WaitForExit()
Dim exitCode = p.ExitCode
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next