Skip to main content

Overview

After successfully installing Gemini CLI in Step 2/3, the installer proceeds to Step 3/3: creating a desktop shortcut for easy access. This page addresses issues related to shortcut creation and functionality.

Warning: Shortcut Creation Failed

Problem Description

After the installer attempts to create the desktop shortcut, you see:
[警告] ショートカットの作成に失敗しました。
English translation:
[Warning] Shortcut creation failed.

Root Cause

The installer uses PowerShell with COM objects (WScript.Shell) to create a shortcut file. The creation may fail due to:
  • PowerShell execution policy restrictions
  • Desktop folder access permissions
  • Corrupted Windows COM registry
  • User profile issues
Source code reference: gemini-cli-easy-installer-20250706.bat:105-112
set "SHORTCUT_PATH=%USERPROFILE%\Desktop\Gemini CLI.lnk"
powershell -ExecutionPolicy Bypass -Command "$WshShell = New-Object -ComObject WScript.Shell; try { $Shortcut = $WshShell.CreateShortcut('%SHORTCUT_PATH%'); $Shortcut.TargetPath = 'powershell.exe'; $Shortcut.Arguments = '-ExecutionPolicy Bypass -NoExit -Command \"gemini\"'; $Shortcut.WorkingDirectory = '%USERPROFILE%'; $Shortcut.IconLocation = 'powershell.exe,0'; $Shortcut.Description = 'Gemini CLI を起動します'; $Shortcut.Save() } catch {}" >nul 2>&1

if exist "%SHORTCUT_PATH%" (
  echo   OK. デスクトップに「Gemini CLI.lnk」ショートカットを作成しました。
) else (
  echo   [警告] ショートカットの作成に失敗しました。
)

Solutions

Solution 1: Manual Shortcut Creation

The most reliable solution is to create the shortcut manually:
1

Right-click on desktop

Right-click on an empty area of your desktop.
2

Create new shortcut

Select New → Shortcut from the context menu.
3

Enter target location

In the “Type the location of the item” field, paste the following:
powershell.exe -ExecutionPolicy Bypass -NoExit -Command "gemini"
Click Next.
4

Name the shortcut

Enter the name: Gemini CLIClick Finish.
5

(Optional) Customize icon

Right-click the newly created shortcut and select Properties.Click Change Icon…Browse to: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exeSelect the PowerShell icon and click OK.
This manual shortcut is functionally identical to the one the installer attempts to create.

Solution 2: Run PowerShell Script Directly

Create the shortcut using a standalone PowerShell script:
1

Open PowerShell as Administrator

Press Win + X and select Windows PowerShell (Admin).
2

Run the shortcut creation script

Copy and paste this script:
$WshShell = New-Object -ComObject WScript.Shell
$ShortcutPath = [System.IO.Path]::Combine(
    [Environment]::GetFolderPath("Desktop"),
    "Gemini CLI.lnk"
)
$Shortcut = $WshShell.CreateShortcut($ShortcutPath)
$Shortcut.TargetPath = "powershell.exe"
$Shortcut.Arguments = '-ExecutionPolicy Bypass -NoExit -Command "gemini"'
$Shortcut.WorkingDirectory = $env:USERPROFILE
$Shortcut.IconLocation = "powershell.exe,0"
$Shortcut.Description = "Launch Gemini CLI"
$Shortcut.Save()

Write-Host "Shortcut created successfully at: $ShortcutPath" -ForegroundColor Green
Press Enter to execute.
3

Verify shortcut creation

Check your desktop for the Gemini CLI.lnk shortcut.

Solution 3: Check PowerShell Execution Policy

The installer uses -ExecutionPolicy Bypass to avoid policy restrictions, but underlying issues may still prevent execution.
1

Check current execution policy

Open PowerShell and run:
Get-ExecutionPolicy -List
Expected output:
        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine       Undefined
2

Set execution policy (if restricted)

If any scope shows “Restricted”, change it:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
You may need administrator privileges. If prompted, type Y and press Enter.
3

Run the installer again

Close PowerShell and run the batch installer again.

Solution 4: Verify Desktop Path

If your Desktop folder is redirected or has unusual permissions:
# Check desktop path
[Environment]::GetFolderPath("Desktop")
Expected output:
C:\Users\YourUsername\Desktop
If this path doesn’t exist or you don’t have write access:
  1. Open File Explorer
  2. Navigate to the path shown
  3. Right-click → Properties → Security
  4. Ensure your user account has “Full control”
  5. If not, click Edit and grant permissions

Shortcut Launch Issues

Even if the shortcut is created successfully, it may not launch Gemini CLI properly.

Issue: Shortcut Opens PowerShell But No Gemini Prompt

Symptoms:
  • Double-clicking the shortcut opens PowerShell
  • PowerShell window stays open but doesn’t show Gemini CLI
  • You see a standard PowerShell prompt instead of Gemini
Diagnosis: The gemini command is not being found by PowerShell. This usually means: Solution:
1

Verify Gemini CLI is installed

In the PowerShell window that opened, run:
gemini --version
If you get an error like:
gemini : The term 'gemini' is not recognized...
Gemini CLI is not properly installed. See Gemini CLI Installation Troubleshooting.
2

Check PATH includes npm global directory

$env:PATH -split ';' | Select-String nodejs
Expected output:
C:\Program Files\nodejs
If this is missing, add it:
# Add to current session
$env:PATH += ";C:\Program Files\nodejs"

# Test gemini command
gemini --version
3

Permanently add to PATH (if needed)

If the PATH is missing permanently:
# Run as Administrator
[Environment]::SetEnvironmentVariable(
    "Path",
    [Environment]::GetEnvironmentVariable("Path", "Machine") + ";C:\Program Files\nodejs",
    "Machine"
)
Restart your computer for changes to take effect.

Issue: PowerShell Closes Immediately

Symptoms:
  • Double-clicking shortcut opens PowerShell briefly
  • Window closes immediately
  • No error message visible
Cause: The -NoExit parameter may not be working, or PowerShell encounters an error before Gemini launches. Solution:
1

Modify shortcut target

Right-click the shortcut → PropertiesIn the Target field, change to:
powershell.exe -NoExit -ExecutionPolicy Bypass -Command "& {Write-Host 'Starting Gemini CLI...'; gemini}"
Click OK.
2

Test the modified shortcut

Double-click the shortcut. You should now see “Starting Gemini CLI…” message before Gemini launches.
3

If still closing, check for errors

Modify the target again to capture errors:
powershell.exe -NoExit -ExecutionPolicy Bypass -Command "& {try {gemini} catch {Write-Error $_; Read-Host 'Press Enter to close'}}"
This will display any errors that occur.

Alternative Launch Methods

If shortcut creation continues to fail, you can launch Gemini CLI using alternative methods:

Method 1: Pin to Taskbar

1

Create a batch file

Create a new file named Launch Gemini CLI.bat with this content:
@echo off
powershell.exe -ExecutionPolicy Bypass -NoExit -Command "gemini"
2

Save to a permanent location

Save the file to: C:\Program Files\Gemini CLI\Launch Gemini CLI.bat(Create the Gemini CLI folder if needed)
3

Pin to taskbar

Right-click the batch file and select Pin to taskbar.

Method 2: Use Windows Terminal Profile

If you use Windows Terminal:
1

Open Windows Terminal Settings

Open Windows Terminal, press Ctrl+, to open settings.
2

Add new profile

Click + Add a new profile+ New empty profile
3

Configure profile

Set the following:
  • Name: Gemini CLI
  • Command line: powershell.exe -NoExit -Command "gemini"
  • Starting directory: %USERPROFILE%
  • Icon: (optional) Path to custom icon
4

Save and use

Click Save. Gemini CLI now appears in your Windows Terminal profiles dropdown.

Method 3: Quick Launch from Run Dialog

You can always launch Gemini CLI without a shortcut:
  1. Press Win + R to open Run dialog
  2. Type: powershell -NoExit -Command gemini
  3. Press Enter
Consider creating a custom Run command alias for faster access. This requires registry editing - advanced users only.

Understanding the Shortcut Configuration

The installer creates a shortcut with these specific settings:
PropertyValuePurpose
Targetpowershell.exeLaunches PowerShell
Arguments-ExecutionPolicy Bypass -NoExit -Command "gemini"Runs gemini command
Start in%USERPROFILE%Sets working directory to user home
Iconpowershell.exe,0Uses PowerShell icon
Description”Gemini CLI を起動します”Tooltip text

Why These Settings?

Allows PowerShell to run the gemini command without checking execution policies. This prevents “script execution disabled” errors.
Keeps the PowerShell window open after the gemini command completes. Without this, the window would close immediately if Gemini exits.
Sets the starting location to your user home directory (e.g., C:\Users\YourName). This ensures any files you create or reference are saved in a predictable location.

Verification Steps

After creating the shortcut (manually or automatically), verify it works:
1

Check shortcut exists

Look for Gemini CLI.lnk on your desktop.
2

Inspect shortcut properties

Right-click the shortcut → PropertiesVerify:
  • Target type: Application
  • Target location: Windows\System32\WindowsPowerShell\v1.0
  • Target: powershell.exe -ExecutionPolicy Bypass -NoExit -Command "gemini"
3

Test launch

Double-click the shortcut.Expected result:
  • PowerShell window opens
  • Gemini CLI startup screen appears
  • You’re prompted to configure theme and authentication

Additional Resources

When to Seek Further Help

The shortcut creation failure is usually a minor inconvenience rather than a critical error. However, seek additional help if:
  1. None of the manual creation methods work
  2. Your user profile seems corrupted
  3. PowerShell execution is blocked by corporate policy
  4. Desktop folder permissions cannot be modified
On corporate-managed computers, IT policies may prevent shortcut creation or PowerShell script execution. Contact your IT department if you encounter persistent issues.

Next Steps

Once you have a working shortcut (or alternative launch method):
  1. Double-click to launch Gemini CLI
  2. Follow the setup wizard to configure theme and authentication
  3. Log in with your Google account
  4. Start using Gemini CLI
Refer to the Introduction and Quickstart for initial configuration steps.

Build docs developers (and LLMs) love