Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
@set APIKEY=your_cloud_api_key
@set URI=
@set FILENAME=instances.json
@if exist %FILENAME% del %FILENAME%
@curl %URI% ^
-sS ^
-d "action=get_instances&API=%APIKEY%" > %FILENAME%
@if %errorlevel% equ 0 (
@REM - Print instance names
@echo Instances
@echo IP OS ServerName Hostname
@echo ----------------------------------------------------------------------
@cat %FILENAME% | jq -r ".success | .[] | [.main_ip,, .srvrname, .hostname] | @tsv" 2>error.log
@if %errorlevel% equ 0 (
@echo ------------------------------
@echo Success
) else (
@REM @echo Exit Code is %errorlevel%
@echo Failed
@cat %FILENAME% | jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment