Used In Windows CMD

Posted at

blunt && direct, here is a working example,


@echo off

setlocal enableextensions
for /f "tokens=*" %%a in ('curl -s storage.googleapis.com/chromium-browser-continuous/Win_x64/LAST_CHANGE 2^>^&1') do (set curl_output=%%a)

echo ---------------------------------------------------------
echo %curl_output%
echo ---------------------------------------------------------
endlocal
pause




notice that

  1. the command curl -s storage.googleapis.com/chromium-browser-continuous/Win_x64/LAST_CHANGE 2^>^&1 contains 2>&1, this is normally used to pipe the output from the 'standard-error' stream to 'standard-output' stream.
  2. if you'll skip using it the %version% variable will be empty...

  3. the 2^>^&1 is the escaped form of 2>&1, you'll need to escape the > and & symbols in CMD-scripts, the ^ character is the CMD-escape character.

  4. you may, also, improve -or- replace the 2>&1 directive, by piping the output through xarg command, in that case, the full command should look similar to this: for /f "tokens=*" %%a in ('curl -s storage.googleapis.com/chromium-browser-continuous/Win_x64/LAST_CHANGE 2^>^&1 | xargs -0 echo') do (set version=%%a)


', 'cURL Output, Stored In Variable