Skip to content

Instantly share code, notes, and snippets.

@Tim-S
Tim-S / poshttp.ps1
Last active December 7, 2024 12:40 — forked from andrii-riabchun/poshttp.ps1
Powershell static http server
#Requires -RunAsAdministrator
# Simple static http server.
Param(
[int]$port = 8080,
[string]$root = (Get-Location)
)
function Serve {
$listener = [System.Net.HttpListener]::new()
$listener.Prefixes.Add("http://+:$port/")