| [VB08] CMD Scripts? (Close please) |
|
Forum Index - Hobbies - Computers & Technology - [VB08] CMD Scripts? (Close please) |
|
Pages: 1  |
Thread Closed |
|
|
| Posted on 2009-11-26 02:42:44 PM |
Link |
|
I'm trying to patch a asm file to a rom via xkas, but it's not working. It won't patch!
Here's the code, the cmd code in bold.
Code Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If CheckBox1.Checked = True Then
If System.IO.File.Exists(TextBox1.Text) = True Then
System.IO.File.Copy(TextBox1.Text, romcopy)
MsgBox("Backup has been succesfully made!", MsgBoxStyle.Information, "Backup Made!")
GoTo StartPatch
Else
MsgBox("File does not exist! Will instead patch the rom without making a backup.", MsgBoxStyle.Critical, "Error 1.00!")
End If
End If
StartPatch:
If System.IO.File.Exists(TextBox1.Text) = True And System.IO.File.Exists(TextBox2.Text) = True Then
Shell("xkas.exe " + TextBox2.Text + TextBox1.Text)
MsgBox("Rom has been successfully patched!", MsgBoxStyle.Information, "Rom patched!")
ElseIf System.IO.File.Exists(TextBox1.Text) = False Then
MsgBox("ROM does not exist!", MsgBoxStyle.Critical, "Error 1.01!")
ElseIf System.IO.File.Exists(TextBox2.Text) = False Then
MsgBox("ASM file does not exist!", MsgBoxStyle.Critical, "Error 1.02!")
End If
End Sub
|
| Last edited on 2009-11-27 06:55:17 AM by x-treme. |
|
| Posted on 2009-11-26 03:59:12 PM |
Link |
|
Although, I'm not to frequent in VB08, I don't know if it matters but it might work if you have this:
Shell("xkas.exe " + TextBox2.Text + TextBox1.Text,AppWinStyle.MinimizedNoFocus)
|
|
| Posted on 2009-11-26 05:03:16 PM |
Link |
|
It would probably be a good idea to make that bolded line this:
Shell("xkas.exe \"" + TextBox2.Text + "\" \"" + TextBox1.Text + "\"")
I don't know much about VB08, but I'm assuming that the \ character indicates an escape sequence, allowing you to represent the quotation marks without closing the string.
Putting quote marks around the filenames allows you to have spaces in the filenames. Also, can I recommend you type out the full path to xkas?
|
|
| Posted on 2009-11-26 08:18:25 PM |
Link |
|
I'm assuming you want the names passed as separate arguments right?
Then, assuming xkas.exe is in the current directory:
Shell("xkas.exe """ & TextBox2.Text & """ """ & TextBox1.Text & """")
otherwise, use:
Shell("""C:\Path to xkas\xkas.exe"" """ & TextBox2.Text & """ """ & TextBox1.Text & """")
Two double quotes escape to a single double quote when used in a string.
So, the second one would look like this:
"C:\Path to xkas\xkas.exe" "Contents of TextBox2.Text" "Contents of TextBox1.Text"
|
|
| Posted on 2009-11-26 08:58:38 PM |
Link |
|
Shell("xkas.exe " + TextBox2.Text + TextBox1.Text)
should be
Diagnostics.Process.Start("xkas.exe " & TextBox2.Text & " " & TextBox1.Text)
You'll probably need the space in between the two textbox texts.
Then, you'll have executed
xkas.exe abc 123
|
|
| Posted on 2009-11-26 09:04:42 PM |
Link |
|
Originally posted by IceplugShell("xkas.exe " + TextBox2.Text + TextBox1.Text)
should be
Diagnostics.Process.Start("xkas.exe " & TextBox2.Text & " " & TextBox1.Text)
You'll probably need the space in between the two textbox texts.
Then, you'll have executed
xkas.exe abc 123
Actually, that doesn't work. Although using my previous example, you could use:
Diagnostics.Process.Start("C:\Path to xkas\xkas.exe", """" & TextBox2.Text & """ """ & TextBox1.Text & """")
Technically you shouldn't need to specify the Diagnostics Namespace in there, as it's automatically imported. So you could just say Process.Start
|
| Last edited on 2009-11-26 09:09:52 PM by sonicmike2. |
|
| Posted on 2009-11-26 09:11:04 PM |
Link |
|
Oh, you actually need the quotes?
Well, nevermind what I said earlier.
|
|
| Posted on 2009-11-26 09:32:03 PM |
Link |
|
|
No, the problem with yours is that Process.Start(fileName As String) doesn't accept arguments. You need to use Process.Start(fileName As String, arguments As String)
|
|
| Posted on 2009-11-27 06:55:02 AM |
Link |
|
Sonicmike2's code worked. Thanks to everybody though. 
This can be closed I guess.
|
|
| Posted on 2009-11-27 08:47:09 AM |
Link |
|
|
Thread(this.ID).Close();
|
|
|
Pages: 1  |
Thread Closed |
|
|
|
Forum Index - Hobbies - Computers & Technology - [VB08] CMD Scripts? (Close please) |