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
serve [-Port] <Int32> [-Folder] <String> [[-KillRoute] <String>] [[-BuffSize]
<Object>] [-NoIndex] [-WirelessOnly] [<CommonParameters>]
The port to serve the folder on
attr |
value |
---|---|
Required? |
true |
Position? |
1 |
Default value |
0 |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
The folder to serve
attr |
value |
---|---|
Required? |
true |
Position? |
2 |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
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 |
The default buffer size
attr |
value |
---|---|
Required? |
false |
Position? |
4 |
Default value |
268435456 |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
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 |
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 |
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).
System.Int32 System.String System.String System.Int32 Switch Switch
[System.String[]]
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.
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
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
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