|
-
Nov 29th, 2005, 02:28 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] Executing command line tool
Hi, I have a little problem with a command line tool.
The command line tool I'm using is par2.exe (par2cmdline). Par2 files are used to check a specific set of rar archives for corruption and to repair them if necessary. This is mainly used in the newsgroups.
I'm using the following command to execute it with VB6:
VB Code:
Private Sub Command1_Click()
ShellAndWait (App.Path & "\par2.exe repair -- " & "D:\Files\*.par2"), vbHide
End Sub
I'm using a wildcard, because I want to check all par2 files in the folder without typing in the name of each par2 file. The problem is that it only checks the first one in the folder (alphabetical order), because it has no batch function.
For example, I have these par2 files in one folder.
Code:
File1.par2
File24.par2
something.par2
testing.par2
When I execute the above command, then it will only check File1.par2 (and corresponding rar archives) and after that it quits.
Is there a way to loop through the folder and execute par2.exe on each file until it has checked all of them?
Thanks.
-
Nov 29th, 2005, 02:36 PM
#2
Re: Executing command line tool
VB Code:
Dim tmp As String
tmp = Dir("D:\Files\*.par2")
Do While tmp > ""
ShellAndWait (App.Path & "\par2.exe repair -- " & "D:\Files\" & tmp), vbHide
tmp = Dir
Loop
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Nov 29th, 2005, 02:53 PM
#3
Thread Starter
Frenzied Member
Re: Executing command line tool
That works. Thank you very much.
There is one more thing.
The par2 file checks for corruption, but there are also the actual repair files which have a par2 extension. They look like this:
Code:
File1.vol000+01.par2
File1.vol001+02.par2
File1.vol003+04.par2
Is there a way to exclude those par2 files (i.e. with *.vol*), because now it uses them to check the rar archives as well. This way the rar archives get checked 4 times.
-
Nov 29th, 2005, 02:58 PM
#4
Re: Executing command line tool
VB Code:
Dim tmp As String
tmp = Dir("D:\Files\*.par2")
Do While tmp > ""
If Instr(tmp,"vol") = 0 Then
ShellAndWait (App.Path & "\par2.exe repair -- " & "D:\Files\" & tmp), vbHide
End if
tmp = Dir
Loop
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Nov 29th, 2005, 03:05 PM
#5
Thread Starter
Frenzied Member
Re: Executing command line tool
Excellent! Thanks for your help
-
Nov 29th, 2005, 03:27 PM
#6
Re: Executing command line tool
no problem 
(Please mark the thread resolved - at the top.. click the thread tools)
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Nov 29th, 2005, 03:49 PM
#7
Thread Starter
Frenzied Member
Re: Executing command line tool
Ok, I'll do that, but for some reason this won't work if I use a Textbox for the filepath. I'm sure that I'm doing something wrong, but I don't know what it is.
I've set it to vbNormalFocus to see what happens and the command window pops up several times and that's it.
VB Code:
Private Sub cmdProcess1_Click()
Dim tmp As String
tmp = Dir(Text1.Text & "\*.par2")
Do While tmp > ""
If InStr(tmp, "vol") = 0 Then
ShellAndWait (App.Path & "\par2.exe repair -- " & Chr$(34) & Text1.Text & "\" & Chr$(34) & tmp), vbNormalFocus
End If
tmp = Dir
Loop
End Sub
-
Nov 29th, 2005, 04:01 PM
#8
Re: Executing command line tool
Don't you want the quote around the whole filename?
-
Nov 29th, 2005, 04:06 PM
#9
Thread Starter
Frenzied Member
Re: Executing command line tool
Thanks, dglienna
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|