Skip to content

Instantly share code, notes, and snippets.

@deskobj
Last active September 15, 2019 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deskobj/4757337 to your computer and use it in GitHub Desktop.
Save deskobj/4757337 to your computer and use it in GitHub Desktop.
Desktop Objects: Launch TightVNC using the Computer Name - or - How to Get IP from Computer Name in MS-DOS Batch -- https://p19z.blogspot.com/2009/01/launch-tightvnc-using-computer-name.html
@setlocal
@ping -n 1 %~2 | find "Pinging" > %TEMP%\ADDR_IPv4.txt
@for /F "tokens=2 delims=[]" %%a in (%TEMP%\ADDR_IPv4.txt) do @set ip=%%a
@endlocal & set "%~1=%ip%"
@REM USAGE: @call StartVncViewer MyComputerName
@setlocal
@call GetIpFromName ip "%~1"
@pushd C:\Progra~1\TightVNC
@start vncviewer.exe %ip%
@popd
@endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment