Home ยป AI ยป Install Google Gemini CLI in Windows for AI Command Line!
AI

Install Google Gemini CLI in Windows for AI Command Line!

Learn the steps to install Google Gemini CLI and enhance your terminal experience with AI features for developers, IT Ops, and sysadmins

There is new buzz around the Google Gemini platform as Google has taken a major step for devs, sysadmins, and CLI power users. They have released the Gemini CLI. This is a command line interface that brings Gemini’s AI features straight to your terminal. If you are working in VS Code, Git Bash, or Windows Terminal, the Gemini CLI will bring a new level of productivity to devs and others. Let’s see how to install Google Gemini CLI on Windows.

What Is Google Gemini CLI?

The Gemini CLI is an open-source command-line tool developed by Google that allows you to interact with the Gemini AI models using natural language, directly from your terminal. This in my opinion comes as a natural follow up to the kubectl-ai command line tool that Google released just a few weeks back.

Gemini models (formerly known as Bard) are Googleโ€™s family of generative AI models. These are similar to OpenAIโ€™s GPT or Anthropicโ€™s Claude. With the CLI, you can:

  • Ask questions and get answers inline in the terminal
  • Generate and explain code snippets
  • Translate commands between Bash, PowerShell, and other shells
  • Refactor scripts or infrastructure-as-code files
  • Generate commit messages based on your git diffs (using the gemini commit feature)
  • Get inline help when working with complex tools (e.g., kubectl, terraform, docker)
  • Chain prompts together to build interactive workflows

Instead of switching back and forth between a browser tab and your terminal, the Gemini CLI acts as your AI assistant. It is embedded in the tool that you are working from natively.

Why Use Gemini CLI in Your Windows Environment?

For Windows developers, admins, and AI tinkerers, having Gemini available via CLI provides many benefits that can help with productivity and efficiency.

  • PowerShell and CMD support: Works with your native Windows tools or WSL
  • Streamlined dev workflow: Query, code, and document all in one place
  • Scripting assistance: You can debug or generate PowerShell, Batch, or Python scripts
  • Git integration: Gemini can help write consistent commit messages using git diff
  • Cross-platform compatibility: Once installed, it behaves the same across Linux, macOS, and Windows

Key Features of the Gemini CLI

Hereโ€™s a breakdown of what you can do with the Gemini CLI:

1. Run Ad-Hoc Prompts

Just like using ChatGPT or Bard in the browser, you can run prompts from the terminal

gemini -p "Explain how Kubernetes handles pod scheduling"

Youโ€™ll get a streamed response right in your terminal window.

2. Use gemini commit to Generate Git Commit Messages

If youโ€™ve staged changes in a Git repo, run:

git diff --cached | gemini -p "Generate a Conventional Commit message"

This scans your git diff and outputs a commit message using the Conventional Commits format. This is incredibly helpful for keeping consistent commit history in team projects.

3. Piped Input Support

You can feed content from other commands:

cat myscript.ps1 | gemini -p "Refactor this PowerShell script to be more readable"

4. Streaming and Interactive Sessions

You can enable streaming mode for faster responses and even use conversational history with --chat mode.

gemini --chat

This launches an interactive shell session with memory, like a terminal-based chatbot powered by Gemini.

5. Custom Prompts and Templates

You can also setup your own prompt templates using .gemini/prompts configuration. This is perfect for standardizing code reviews, documentation generation, or analysis.

How to Install Google Gemini CLI on Windows

Now that we have seen what Gemini CLI can do, letโ€™s install it on your Windows machine. This process supports PowerShell, CMD, or WSL, but we’ll focus on the easiest method for most users: using Scoop or manually downloading the binary.

I really like using Winget for these types of operations. It makes upgrades and other operations extremely easy in the future. First, install OpenJS.NodeJS with the command:

winget install -e --id OpenJS.NodeJS
Using winget to install nodejs
Using winget to install nodejs

Then, just install gemini using npm install:

npm install -g @google/gemini-cli

Setting things up and authenticating

There are a couple of things that will happen once you install Gemini. You will be asked to setup the appearance of the terminal, and then you will be asked to authenticate. So, you will need a Google account.

You will first be asked the appearance of the gemini CLI that you want to set.

Select the appearance of the gemini cli terminal
Select the appearance of the gemini cli terminal

Next, it will ask how you want to authenticate.

Select the login method
Select the login method

Once you choose Login with Google, it will wait for you to authenticate in the browser session.

Waiting for authentication to complete
Waiting for authentication to complete

You will see a normal Google login prompt launch asking you to select your account.

Google authentication in the browser
Google authentication in the browser

Once authenticated, you will see the following screen displayed.

Authentication was successful
Authentication was successful

Then, you will be taken back to the Gemini CLI prompt as you are now authenticated and ready to start prompting and chatting.

Google gemini cli launches
Google gemini cli launches

Useful Dev Examples

Now that itโ€™s installed, here are a few fun and useful things to try with Gemini CLI on Windows:

1. Translate Between Shells

gemini -p "Convert this bash script to PowerShell"

2. Explain Infrastructure Code

cat main.tf | gemini -p "What does this Terraform code do?"

3. Generate Batch Scripts

gemini -p "Create a Windows batch script to back up files to a USB drive"

4. Ask Gemini to Explain Git Errors

gemini -p "fatal: refusing to merge unrelated histories โ€“ how do I fix this?"

5. Document PowerShell Scripts

cat script.ps1 | gemini -p "Add inline comments to explain what this PowerShell script does"

Pro Tips for Using Gemini CLI Like a Pro

  • Add aliases like alias g='gemini' to shorten command usage
  • Combine with tools like fzf, bat, and ripgrep for enhanced terminal workflows
  • Use --chat mode for longer sessions, like pair programming
  • Use .gemini/config.toml to customize behavior (e.g., temperature, model version
  • Try piping code from your editor or clipboard: Get-Clipboard | gemini -p "Summarize this"

Wrapping up

It is exciting to see where things are headed in the world of AI and AI tools. AI has leveled the playing field in so many ways and continues to astound us with the possibilities. It is also exciting to see how AI is getting “closer” to the tools we use and providing this native integration. We won’t be copying and pasting things much longer between chat windows as the tools are just natively there and we can prompt AI in the tool we are in, like the command line.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.