@ECHO OFF

if "%1"=="" (
    pushd %1
)


::get the object line
::http://www.bathome.net/thread-9512-1-1.html
for /f "tokens=*" %%i in ('ipconfig ^|findstr IPv4') do (
    SET IPLine=%%i
)

::split by ":" and obtain the second element
for /f "tokens=2 delims=:" %%j in ("%IPLine%") do (
    SET IPv4Line=%%j
)

::get the substring
SET IPv4=%IPv4Line:~1%

::copy host to clipboard
echo http://%IPv4%/ | clip

python -m http.server --bind %IPv4% 80


::参考
::https://www.cnblogs.com/accumulater/p/10647497.html
::https://stackoverflow.com/questions/6359820/how-to-set-commands-output-as-a-variable-in-a-batch-file