1@echo off
2
3REM Copyright (c) 2012 The Chromium Authors. All rights reserved.
4REM Use of this source code is governed by a BSD-style license that can be
5REM found in the LICENSE file.
6
7set CHANNEL=%1
8
9REM Check if we are running as an Administrator.
10REM Based on method described at:
11REM http://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
12net session >nul 2>&1
13if not %errorlevel% equ 0 (
14  echo This script updates the registry and needs to be run as Administrator.
15  echo Right-click "Command Prompt" and select "Run as Administrator" and run
16  echo this script from there.
17  goto :eof
18)
19
20REM Make sure the argument specifies a valid channel.
21if "_%CHANNEL%_"=="_beta_" goto validarg
22if "_%CHANNEL%_"=="_stable_" goto validarg
23goto usage
24
25:validarg
26set SYSTEM32=%SystemRoot%\system32
27if "_%PROCESSOR_ARCHITECTURE%_"=="_AMD64_" set SYSTEM32=%SystemRoot%\syswow64
28
29set REGKEY="HKLM\SOFTWARE\Google\Update\ClientState\{B210701E-FFC4-49E3-932B-370728C72662}"
30set VALUENAME=ap
31
32if "_%CHANNEL%_"=="_stable_" (
33  %SYSTEM32%\reg.exe delete %REGKEY% /v %VALUENAME% /f
34  echo ********************
35  echo You're not done yet!
36  echo ********************
37  echo You must now UNINSTALL and RE-INSTALL the latest version of Chrome
38  echo Remote Desktop to get your machine back on the stable channel.
39  echo Thank you!
40) else (
41  %SYSTEM32%\reg.exe add %REGKEY% /v %VALUENAME% /d %CHANNEL% /f
42  echo Switch to %CHANNEL% channel complete.
43  echo You will automatically get %CHANNEL% binaries during the next update.
44)
45goto :eof
46
47:usage
48echo Usage: %0 ^<channel^>
49echo where ^<channel^> is 'beta' or 'stable'.
50