Gemini CLI Tutorial (Windows)

A student friendly guide to install Gemini CLI and use it daily for coding, debugging, file based context, command piping, project rules, and automation.

Beginner friendly PowerShell focused Practical commands

What students will learn

  • Install and verify Gemini CLI
  • Login once and reuse
  • Read local files using @
  • Pipe command output with |
  • Use GEMINI.md for permanent rules
  • Run one line automation

0 Before you start

Gemini CLI runs through Node.js. You will install Node.js first, then install Gemini CLI using npm. This tutorial assumes Windows + PowerShell.

Tip: To open PowerShell in a folder, right click inside the folder and select Open in Terminal.

System requirements

Windows 10 or 11 PowerShell Node.js 18+ (LTS) Internet Google account

1 Install Node.js

Gemini CLI is installed with npm, and npm comes with Node.js. Use Node.js LTS.

Check if Node.js is already installed

node --version
npm --version
If you see "command not found", install Node.js LTS from nodejs.org, then restart PowerShell and run the version commands again.

2 Install Gemini CLI

Install Gemini CLI globally. This makes the gemini command available everywhere.

npm install -g @google/gemini-cli

Verify installation

gemini --version
If you see a version number, installation is successful.

3 Fix PATH on Windows (if needed)

Sometimes Windows does not find npm global commands immediately. If gemini --version fails, add npm global path to your session.

$env:Path += ";C:\Users\<YOUR-USERNAME>\AppData\Roaming\npm"
gemini --version
Replace <YOUR-USERNAME> with your Windows username. You can find it in C:\Users\.

4 Login once (authentication)

Login connects Gemini CLI to your Google account. This is usually one time only.

gemini auth login
This command opens your browser. Sign in, grant permission, then return to PowerShell. The session is cached, so you do not login every time.

5 Start interactive mode

Interactive mode is like a chat session, but it can read files and accept piped text.

gemini

Useful inside chat

/clear
/reset
/exit
/clear clears the screen.
/reset resets current session context.
/exit exits Gemini CLI.

6 Read files using @

The symbol @ means: read this file and include it as context. This is the key advantage over browser chat.

Explain a Python script

@script.py Explain this code step by step

Compare two versions

@v1.py @v2.py What is the difference between these scripts?
Avoid using wildcards on very large folders. It may overload context and reduce answer quality.

Wildcard example (small folder only)

@*.txt Summarize these notes into one paragraph

7 Pipe command output using |

Piping lets you send output from any command directly into Gemini. This avoids copy and paste. It is ideal for logs, Git diffs, and system diagnostics.

Explain an error log

Get-Content error.log | gemini "What caused this error and how do I fix it?"

Write a Git commit message

git diff | gemini "Write a concise commit message for these changes"

Find memory heavy processes

Get-Process | gemini "Which top 3 apps use the most memory? Explain briefly."

8 Permanent project rules with GEMINI.md

You can set custom instructions per project. Gemini CLI automatically reads GEMINI.md from the current folder.

Create a project folder

mkdir C:\Users\mahbu\MyCodingProject
cd C:\Users\mahbu\MyCodingProject

Create GEMINI.md

# GEMINI.md
You are a strict senior Python reviewer.
Prefer efficient code.
Point out bugs and edge cases.
Be concise and practical.
Now every time you run gemini inside that folder, these rules apply automatically.

9 One line automation

You can run a single prompt and exit immediately. This is useful for scripts and quick tasks.

gemini "Write a professional email saying I will be 10 minutes late to the meeting"
Students can embed this into batch scripts, research pipelines, or Git hooks.

10 Cheat sheet

Goal Command Example
Start chat gemini Interactive session
Read file @filename @data.csv Analyze this
Read many files @*.py Find bugs in these scripts
Pipe output command | gemini "prompt" git diff | gemini "commit msg"
One line ask gemini "text" Quick help then exit
Clear screen /clear Inside chat mode
Reset session /reset Inside chat mode
Exit /exit Inside chat mode

11 Student assignment

This short task proves that Gemini CLI can analyze real system output.

Get-Process | gemini "Identify the top 3 memory consuming processes. Explain what each likely does."
Note: Gemini only sees what PowerShell prints. It does not control your computer. It analyzes text output like any other input.