-3

I want to download and execute an exe using javascript. I have tried to do this through windows powershell but haven't succeeded to execute powershell code from javascript. Any help is appreciated

Asad Ali
  • 11
  • 1
  • 4
  • WSH is likely more useful – mplungjan Nov 14 '16 at 09:57
  • See the below link http://stackoverflow.com/questions/18980957/is-it-possible-to-run-an-exe-or-bat-file-on-onclick-in-html It may help you – M14 Nov 14 '16 at 10:00
  • "PowerShell (New-Object System.Net.WebClient).DownloadFile('http://www.rarlab.com/rar/wrar420cro.exe','mess.exe');Start-Process 'mess.exe'"; This command downloads and execute the downloaded exe. i have tried to run this command through javascript like this "exec("PowerShell (New-Object System.Net.WebClient).DownloadFile('http://www.rarlab.com/rar/wrar420cro.exe','mess.exe');Start-Process 'mess.exe'";" But have not succeeded. – Asad Ali Nov 14 '16 at 10:54

1 Answers1

3

This isn't possible. JavaScript doesn't have any method to allow you to download, not to mention run an exe.

If it were possible, we'd all be incapable of browsing the internet due to the amount of viruses we'd be downloading and running involuntarily.

Cerbrus
  • 70,800
  • 18
  • 132
  • 147