.. index:: single: serve serve ===== Serve a folder over the network with a specific port -------------- :: Version : 1.0 File Name : serve.ps1 Author : Adewale Azeez - iamthecarisma@gmail.com Date : April-04-2021 -------------- Serve a folder under all the available IPv4 address on your system, (Ethernet, Wireless, LAN, WAN, Local Host e.t.c), with a specific port. It impossible to kill the server while it running except by visiting the kill route which is /kill by default Use the -KillRoute to specify a custom kill route Syntax ------ .. code:: powershell serve [-Port] [-Folder] [[-KillRoute] ] [[-BuffSize] ] [-NoIndex] [-WirelessOnly] [] Parameters ---------- -Port :Int32 ~~~~~~~~~~~~ The port to serve the folder on =========================== ===== attr value =========================== ===== Required? true Position? 1 Default value 0 Accept pipeline input? false Accept wildcard characters? false =========================== ===== -Folder :String ~~~~~~~~~~~~~~~ The folder to serve =========================== ===== attr value =========================== ===== Required? true Position? 2 Default value Accept pipeline input? false Accept wildcard characters? false =========================== ===== -KillRoute :String ~~~~~~~~~~~~~~~~~~ The route to use for killing the server =========================== ===== attr value =========================== ===== Required? false Position? 3 Default value /kill Accept pipeline input? false Accept wildcard characters? false =========================== ===== -BuffSize :Object ~~~~~~~~~~~~~~~~~ The default buffer size =========================== ========= attr value =========================== ========= Required? false Position? 4 Default value 268435456 Accept pipeline input? false Accept wildcard characters? false =========================== ========= -NoIndex [:SwitchParameter] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ If specified do not send index.html for a folder =========================== ===== attr value =========================== ===== Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false =========================== ===== -WirelessOnly [:SwitchParameter] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Serve on onle Wireless LAN/WAN IPv4 Addresses =========================== ===== attr value =========================== ===== Required? false Position? named Default value False Accept pipeline input? false Accept wildcard characters? false =========================== ===== CommonParameters ~~~~~~~~~~~~~~~~ This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). Inputs ------ System.Int32 System.String System.String System.Int32 Switch Switch Outputs ------- [System.String[]] EXAMPLE 1 --------- :: serve 2000 C:/folder Serve the folder ‘C:/folder’ over the port 2000 on all the IPv4 address including localhost:2000 and 127.0.0.1:2000. If a file name index.html is in the folder C:/folder it is served instead of listing the files and folders. EXAMPLE 2 --------- :: serve 2000 C:/folder -NoIndex Serve the folder ‘C:/folder’ over the port 2000 on all the IPv4 address including localhost:2000 and 127.0.0.1:2000 If index.html is in the folder C:/folder it is ignored and the files and folders are listed EXAMPLE 3 --------- :: serve 2000 C:/folder -KillRoute jwyqsahsjh Serve the folder ‘C:/folder’ over the port 2000 on all the IPv4 address including localhost:2000 and 127.0.0.1:2000. Since using Ctrl+C does not shutdown the server, visiting the address with the route /jwyqsahsjh e.g. 127.0.0.1:2000/jwyqsahsjh will kill the server EXAMPLE 4 --------- :: serve 2000 C:/folder -WirelessOnly Serve the folder ‘C:/folder’ over the port 2000 on only Wireless LAN and WAN IPv4 addresses only including localhost:2000 and 127.0.0.1:2000, ethernet and other network IPv4 addresses are ignored Related links ------------- - https://thecarisma.github.io/Cronux