-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathservesite.bat
33 lines (29 loc) · 1.02 KB
/
servesite.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@echo off
title servesite
echo This requires Python 3 to be installed in order to run.
echo Auto IP detection might not work on older devices. Sorry!
if [%1] equ [localhost] goto :localhost
if [%1] equ [127.0.0.1] goto :localhost
if [%1] equ [::] goto :localhost
if [%1] neq [] goto :neq
set ip_address_string="IPv4 Address"
for /f "usebackq tokens=2 delims=:" %%f in (`ipconfig ^| findstr /c:%ip_address_string%`) do (
set foundip=%%f
goto :runHere
)
:runHere
echo Using assumed IP address %foundip%
echo If you are unable to access this site from other computers on the LAN,
echo please find the correct IP with ipconfig and add that to the command instead.
python -m http.server 80 --directory src --bind%foundip%
goto :eof
:neq
echo Using provided IP address %1
python -m http.server 80 --directory src --bind %1
goto :eof
:localhost
echo Using localhost. You will not be able to access
echo the page from other devices on the network.
python -m http.server 80 --directory src
goto :eof
:eof