Résolu Comment deplacer un fichier en vb.net

M

Membre578448

Je m'explique j'ai mis ce code :
My.Computer.Network.DownloadFile(
" ",
"C:\Users\SweeZ\Desktop\shutdown.exe")

et je voudrais que au lieu d'avoir : "C:\Users\SweeZ\Desktop\shutdown.exe")
ce qui deplace le fichier mais uniquement sur mon pc ( hehe bah oui tout le monde ne s'apelle pas sweez ^^^ ) comment je pourrait faire pour que sa soit universelle du style : "C:\Users\%user%\Desktop\shutdown.exe")
 
M

Membre578448

Voila
Directory.CreateDirectory(this.dossiertemp);
MyProject.Computer.FileSystem.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\smash.dll", BLSquad_4.My.Resources.Resources.smash3, false);
new WebClient().DownloadFile(" ", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\InjectionSmasher.exe");
 

Rivals

Ancien staff
Inscription
27 Août 2016
Messages
1 706
Réactions
897
Points
13 104
Voila
Directory.CreateDirectory(this.dossiertemp);
MyProject.Computer.FileSystem.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\smash.dll", BLSquad_4.My.Resources.Resources.smash3, false);
new WebClient().DownloadFile(" ", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\InjectionSmasher.exe");
Utilise la balise CODE c'est plus lisible stp
 

Wims

Premium
Inscription
27 Août 2014
Messages
1 805
Réactions
418
Points
15 911
Voila
Directory.CreateDirectory(this.dossiertemp);
MyProject.Computer.FileSystem.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\smash.dll", BLSquad_4.My.Resources.Resources.smash3, false);
new WebClient().DownloadFile(" ", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\InjectionSmasher.exe");
Avec le lien que je t'ai donné + ce code tu as ta réponse sous les yeux :espion:

Tu récupères d'abord le nom d'utilisateur de la session actuelle, puis tu complètes le chemin
 
M

Membre578448

Code:
        Directory.CreateDirectory(this.dossiertemp);
        MyProject.Computer.FileSystem.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\smash.dll", BLSquad_4.My.Resources.Resources.smash3, false);
        new WebClient().DownloadFile("http://blsquad.fr/Logiciel/cmac3.exe", Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\AppData\\Roaming\\Files-BLSquad\\InjectionSmasher.exe");
 

Ashuz

Super modérateur
Inscription
10 Janvier 2015
Messages
17 936
Réactions
8 467
Points
30 647
Salut,
Ta demande est-elle résolue ?

Si oui, je t'invite à cliquer sur Cette réponse a répondu à ma question sur le message qui t'a aidé pour rajouter le préfixe résolu à la discussion. :)

Bonne fin de soirée,
Ashuz SEC
 
Haut