Question Opening external batch files from an unknown directory

chris-to-berg

New member
Joined
Dec 1, 2010
Messages
1
Programming Experience
Beginner
I have two questions today. I have recently created a form that will recompress certain files into another file if certain options are ticked. Here is a snippet of the source code:

If CheckBox1.Checked = True And CheckBox2.Checked = True And CheckBox3.Checked = True Then
MessageBox.Show("Insert BAT")
End If
If CheckBox2.Checked = True Then
MessageBox.Show("insert BAT")
End If

If CheckBox2.Checked = True And CheckBox3.Checked = True Then
MessageBox.Show("insert BAT")
End If

I'm sure you get the idea. I know I have the completely wrong coding where I put MessageBox.Show("insert BAT"), but that's just something I put there to test other things. What I want to replace that code with is a way of opening a batch file. Something that seems to be important is also the fact that the batch file will be in a different directory on different machines as my sfx option will allow people to install this application anywhere. However the batch files will always be in the "Application >> Batch Files", but the directory for the application folder may differ e.g Desktop\Application\Batch Files or C:\Program Files (x86)\Application\Batch Files
Also at current if I, for example check checkboxes 1 and 2 I get 3 messages, one from checkbox 1 ticked, one from checkbox 1 and 2 ticked and one from checkbox 2 ticked. Is there a way to automatically only carry out the checkbox 1 and 2 ticked batch file? What I'm wanting is something along the lines of:

If CheckBox1.Checked = True Then
MessageBox.Show("Insert BAT")
Unless CheckBox1.Checked = True And CheckBox2.Checked = True Then
MessageBox.Show("Insert first BAT")
End If

If you're a bit confused as to what I'm asking in the second part of my question please ask. What I was wanting to highlight was the use of the word unless, which I know isn't valid code, but I want a code to this effect. Thanks in advance :D
 
Last edited:
Top Bottom