How to launch Chrome from command prompt

As a developer I have many browsers installed on my system. Today, as part of an automation I was trying to launch a Chrome tab from command prompt and had some difficulties with it. On a clean machine with just Chrome installed if you type the following it will open a facebook tab in Chrome:

start "" chrome ""

Since I’ve both Canary and Chrome installed, it was launching Canary instead. After spending some time investigating (and getting some help from others) the issue become clear. If you navigate to registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths, you can see an entry for chrome.exe. Since Canary is installed for Current User only, it was shadowing the Local Machine entry which is located at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe. Renaming the Current User chrome.exe to chromesxs.exe solves the problem (I love simple solutions!). Now I can launch both Chrome browsers from my command prompt.

Happy hacking!

Listing connected devices and emulators on Cordova platform

For developers who are familiar with the web stack (html+javascript+css), cross platform mobile application development is now a breeze thanks to Apache Cordova. Developers can use all the frameworks and libraries they are familiar with and create native experiences in an ever expanding array of devices.

One natural consequence of having such a big array of devices is that most of the time developers end up testing their applications on a number of different OS/Device targets. This problem is very easy to observe for Android for example:

Available SDKs for Android

Luckily Cordova lets us deploy to a specific device (using cordova run --target=FOO) but with so many potential targets available, sometimes it’s not so easy to figure out which device we’re deploying to. For a while now, there are platform level scripts available to figure out which targets are available in the system (Cordova wiki) but they are not easily accessible from the Cordova CLI.

With the introduction of --list Cordova users will be able to see which targets are available in their system. For a second, let’s assume we have the latest Cordova installed: cordova run --help will print the following on our console window:

c:\path\to\cordova\app>cordova run --help                                                                                            
    cordova run [MODE] [PROD] [TARGET] [EXP] [PLATS] [-- POPTS]                                                           
      MODE:       --list|--nobuild                                                                                        
      PROD:        --debug|--release                                                                                      
      TARGET:      DEVICECLASS|--target=FOO                                                                               
      EXP:         --experimental [EXPERIMENTALFLAGS]                                                                     
      PLATS:       PLATFORM [...]                                                                                         
      POPTS:       platformopts                                                                                           
      DEVICECLASS: --device|--emulator                                                                                    
Deploys app on specified platform devices / emulators                                                                     
    --nobuild .......................... don't build                                                                      
    --debug ............................ Deploy a debug build                                                             
    --release .......................... Deploy a release build                                                           
    --device ........................... Deploy to a device                                                               
    --emulator ......................... Deploy to an emulator                                                            
    --target ........................... Deploy to a specific target                                                      
    --list ............................. Lists available targets                                                          
                                         Will display both device and emulator                                            
                                         unless DEVICECLASS option is provided                                            
To provide platform specific options, you must include them after `--`.                                                   
Technical details                                                                                                         
    calls cordova prepare                                                                                                 
    calls PLATFORM run                                                                                                    
        PLATFORM run calls PLATFORM build (unless --nobuild)                                                              
Experimental Flags                                                                                                        
    --browserify ....................... Plugins javascript gets loaded at build time instead of runtime using browserify.
                                         Replaces cordovajs file with one that includes the JS of the installed plugins.  

Please note that we now have --list as an available option. If we want to deploy our app to an Android emulator/device all we have to do at this point is to type in the following:

c:\path\to\cordova\app>cordova run android --list 
Available android devices:             
Available android virtual devices:     

Tip: You can add & remove virtual devices using the Android Virtual Device (AVD) Manager.

Once you know which targets are available in your machine, it’s easy to deploy your app: cordova run --target=015d483b891ffe0c

Happy coding!

Local Cordova Development

Working with Cordova is usually pretty straightforward, the CLI is very flexible. However there are times where a developer might need to change some behavior in Cordova or apply a fix. In order to be able to apply patches on Cordova, first we have to uninstall it using NPM.

npm uninstall -g cordova

After removing cordova from global we need to install 3 repositories.

git clone git://
git clone git://
git clone git://

Assuming that we’ve installed the repo’s to c:\dev below are the final instructions for the setup:

cd c:\dev\cordova-lib\cordova-lib
npm install & npm link
cd ..\..\cordova-cli
npm link cordova-lib
npm install
cd ..\cordova-plugman
npm link cordova-lib
npm install

Now your local cordova installation should be ready. The last step is to add c:\dev\cordova-cli\bin to your PATH. After you’re done when you type in

cordova -v

it should display the latest dev version!