Skip to content

Instantly share code, notes, and snippets.

@franga2000
Created January 3, 2017 18:57
Show Gist options
  • Save franga2000/f964a521b051e434a01d5c034ca8efcb to your computer and use it in GitHub Desktop.
Save franga2000/f964a521b051e434a01d5c034ca8efcb to your computer and use it in GitHub Desktop.
A shitty screen sharing script I use for presentations sometimes
@echo off
rem Uses SpaceDesk (http://spacedesk.ph/download/)
rem Put in the same folder as: spacedeskPersonalView.exe, XML wifi profile file (Wi-Fi-FrangezM.xml)
rem Run script, plug in wifi card (ONLY IF there isn't one), start hotspot on laptop (same settings as XML)
rem When Spacedesk opens, CTRL+SHIFT+C for connect menu, ALT+Enter for fullscreen
rem When done, close Spacedesk, the script will clean up the rest
rem Switch to Unicode
@chcp 65001
rem CD to script folder
cd /D "%~dp0"
rem Echo shitty banner (feel free to change the name so you can look smart too)
echo ####################################
echo # #
echo # Shitty presentation script #
echo # © Miha Frangež, 2017 #
echo # #
echo ####################################
echo.
rem Wait for wireless interface to appear
echo Waiting for wireless interface...
:interface
netsh wlan show interfaces | find "AR9271"
if not %errorlevel% == 0 (
call :sleep 5
goto interface
)
rem Find and connect to wireless network
echo.
echo Waiting for wireless network...
:network
netsh wlan show networks | find "FrangezM"
if not %errorlevel% == 0 (
call :sleep 1
goto network
)
dir
echo.
echo Connecting to wireless network...
netsh wlan add profile filename=Wi-Fi-FrangezM.xml
netsh wlan connect name=FrangezM
if not %errorlevel% == 0 (
echo Something broke. Connect manually.
pause
)
rem Do nothing
echo Bootstrapping libraries...
call :sleep 1
rem Run spaceDesk and wait for it to close
echo Launching spaceDesk!
start /wait spacedeskPersonalView.exe
echo Waiting for spaceDesk to exit...
rem Remove wireless network and interface
echo.
echo Cleaning up...
netsh wlan delete profile name=FrangezM
echo.
echo All done!
echo.
pause
rem Bye!
echo.
echo Goodbye! :)
echo.
rem Very hacky sleep function because Batch is horrible like that
:sleep
@ping 127.0.0.1 -n %* > nul
exit /b 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment