Created
August 26, 2015 21:17
-
-
Save viovanov/fadc0268ac6d8d48e492 to your computer and use it in GitHub Desktop.
one liner to run a web server from a windows command prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell -command "$l = New-Object System.Net.HttpListener ; $l.Prefixes.Add('http://+:8080/'); $l.Start(); while ($l.IsListening) { $c = $l.GetContext() ; $q = $c.Request; Write-Output (date); $r = $c.Response ; $m = [System.Text.ASCIIEncoding]::ASCII.GetBytes(((gci -path env:*) | Out-String)); $r.ContentLength64 = $m.Length ; $r.OutputStream.Write($m, 0, $m.Length) ; $r.OutputStream.Dispose(); }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment