Was mache ich falsch?

03/29/2013 17:00 955NONAME#1
Hallo zusammen,

habe mal wieder ein Problem bzw komme nicht weiter.

Code:
If System.IO.File.Exists("C:\Documents and Settings\All Users\Documents\DATEI.exe") Then
           My.Computer.FileSystem.DeleteFile("C:\Documents and Settings\All Users\Documents\DATEI.exe")
         My.Computer.Network.DownloadFile("http://link.exe", "C:\Documents and Settings\All Users\Documents\DATEI.exe")
           Shell("C:\Documents and Settings\All Users\Documents\DATEI.exe")
           
        Else

            My.Computer.Network.DownloadFile("http://link.exe", "C:\Documents and Settings\All Users\Documents\DATEI.exe")
            Shell("C:\Users\Public\Documents\DATEI.exe")
        End If
Was möchte ich mit dem Code machen?

Ich möchte das mein Programm überprüft ob die "DATEI.exe" schon vorhanden ist und wenn sie vorhanden ist dann soll diese gestartet werde.

Und falls die "DATEI.exe" nicht vorhanden ist soll Sie ehrst gedownloadet werden und danach wieder gestartet werden.



Könnt ihr mir helfen?



Gruß

955NONAME
03/29/2013 17:06 reCougar#2
Kenne mich jetzt nicht so mit VB aus aber ist vielleicht das eine else zu viel ? Ansonsten würde ich gerne fragen ob die Datei welche du runterladen möchtest die gestartete ist ?
03/29/2013 17:09 Mansuro#3
So sollte es gehen:

Code:
If System.IO.File.Exists("C:\Documents and Settings\All Users\Documents\DATEI.exe") Then
           My.Computer.FileSystem.DeleteFile("C:\Documents and Settings\All Users\Documents\DATEI.exe")
         My.Computer.Network.DownloadFile("http://link.exe", "C:\Documents and Settings\All Users\Documents\DATEI.exe")
           Shell("C:\Documents and Settings\All Users\Documents\DATEI.exe")

        Else

            My.Computer.Network.DownloadFile("http://link.exe", "C:\Documents and Settings\All Users\Documents\DATEI.exe")
            Shell("C:\Users\Public\Documents\DATEI.exe")
        End If
03/29/2013 17:11 955NONAME#4
Quote:
Originally Posted by Spleech™ View Post
Kenne mich jetzt nicht so mit VB aus aber ist vielleicht das eine else zu viel ? Ansonsten würde ich gerne fragen ob die Datei welche du runterladen möchtest die gestartete ist ?
Nein die Datei die ich Downloade ist nicht das "Programm" das schon offen ist.
03/29/2013 17:24 vwap#5
Du hast den Code doch gepostet.
Wo ist das Problem?
03/29/2013 17:26 955NONAME#6
Ich habe das Problem gelöst es lag daran, das ich shell(Pfad) gemacht habe und nicht process.start(Pfad)