-
May 22nd, 2018, 12:51 PM
#1
Thread Starter
Junior Member
Start Up the file
Hi, I have the same problem with this button:
HTML Code:
My.Computer.FileSystem.CreateDirectory("C:\ProgramData\KDetector")
If System.IO.File.Exists("C:\ProgramData\KDetector\Bucky Roberts 3.2.exe") Then
Else
My.Computer.Network.DownloadFile("link removed", "C:\ProgramData\KDetector\Bucky Roberts 3.2.exe")
Shell("C:\ProgramData\KDetector\Bucky Roberts 3.2")2
It download the program and put it to the correct folder but the program doesn't start up
Thanks to everyone that will help me.
Last edited by dday9; May 24th, 2018 at 04:43 PM.
-
May 22nd, 2018, 01:30 PM
#2
Re: Start Up the file
My first suggestion is to build your path via IO.Path.Combine. My second suggestion is to eliminate the first If statement since you don't do anything with it anyways. My last suggestion would be to use Process.Start to launch the program after the If/Then statement.
Here is an example:
Code:
'Get the directory
Dim folder As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "KDetector")
If Not IO.Directory.Exists(folder) Then
'Create the directory if it doesn't exist
IO.Directory.CreateDirectory(folder)
End If
'Get the file
Dim file As String = IO.Path.Combine(folder, "Bucky Roberts 3.2.exe")
If Not IO.File.Exists(file) Then
'Download the file if it doesn't exist
My.Computer.Network.DownloadFile("link removed", file)
End If
'Start the executable
Diagnostics.Process.Start(file)
Edit - It is worth mentioning that you should probably wrap all this code in a Try/Catch statement. There are several things that could go wrong, especially when dealing with IO operations and downloading files.
Last edited by dday9; May 24th, 2018 at 04:43 PM.
-
May 22nd, 2018, 05:26 PM
#3
Re: Start Up the file
Originally Posted by dday9
My first suggestion is to build your path via IO.Path.Combine. My second suggestion is to eliminate the first If statement since you don't do anything with it anyways. My last suggestion would be to use Process.Start to launch the program after the If/Then statement.
Here is an example:
Code:
'Get the directory
Dim folder As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "KDetector")
If Not IO.Directory.Exists(folder) Then
'Create the directory if it doesn't exist
IO.Directory.CreateDirectory(folder)
End If
'Get the file
Dim file As String = IO.Path.Combine(folder, "Bucky Roberts 3.2.exe")
If Not IO.File.Exists(file) Then
'Download the file if it doesn't exist
My.Computer.Network.DownloadFile("link removed", file)
End If
'Start the executable
Diagnostics.Process.Start(file)
Edit - It is worth mentioning that you should probably wrap all this code in a Try/Catch statement. There are several things that could go wrong, especially when dealing with IO operations and downloading files.
pretty sure thats a minecraft cheating tool or anti cheat either way if you quickly reverse it imports a lot of suspect apis. one a user would not be using and asking how to add registry keys.
Last edited by dday9; May 24th, 2018 at 04:43 PM.
-
May 23rd, 2018, 12:03 PM
#4
Thread Starter
Junior Member
Re: Start Up the file
I have another error with
Code:
Diagnostics.Process.Start(file)
This is the error: System.ComponentModel.Win32Exception: 'The specified executable is not a valid application for this OS platform.'
-
May 23rd, 2018, 12:17 PM
#5
Re: Start Up the file
Originally Posted by Lorenzo_7
I have another error with
Code:
Diagnostics.Process.Start(file)
This is the error: System.ComponentModel.Win32Exception: 'The specified executable is not a valid application for this OS platform.'
If you download the file manually and try to execute it does it run?
-
May 23rd, 2018, 12:56 PM
#6
Thread Starter
Junior Member
Re: Start Up the file
Yes, maybe it must have admin rights?
-
May 24th, 2018, 11:49 AM
#7
Thread Starter
Junior Member
-
May 24th, 2018, 04:23 PM
#8
Re: Start Up the file
Shell("C:\ProgramData\KDetector\Bucky Roberts 3.2")
what goes at the end of a file...EXE
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
|