yazi on windows shell echo "test" returns process exited with status code 1
- User
yazi on windows shell echo "test" returns process exited with status code 1
Assistant
Of course! This is a very common issue for new
yaziusers on Windows.The error
process exited with status code 1when running a simple command likeecho "test"almost certainly means that Yazi is configured to use the wrong shell for your Windows environment.The Problem Explained
By default, Yazi's configuration is often geared towards Linux or macOS systems, which use shells like
bashorzsh. To run an external command (likeecho), Yazi tries to execute it using a command like:sh -c "echo 'test'"On a standard Windows installation, there is no
sh.exein your system's PATH. When Yazi tries to find and runsh, the operating system can't find it, and the process fails immediately, returning a generic error code (status 1).The Solution: Configure Yazi to Use a Windows Shell
You need to tell Yazi to use either PowerShell (recommended) or the classic Command Prompt (
cmd.exe). You do this by editing youryazi.tomlconfiguration file.
Step 1: Find or Create Your
yazi.tomlFileYour Yazi configuration files are located in the Windows AppData directory. You can paste this path directly into your File Explorer's address bar:
%APPDATA%\yazi\config\Inside that folder, look for a file named
yazi.toml.- If it exists, open it with a text editor.
- If it does not exist, create a new text file and name it
yazi.toml.
Step 2: Add the Shell Configuration
Add the following lines to your
yazi.tomlfile. You have two main options.
Option A: Use PowerShell (Recommended)
PowerShell is the modern, powerful shell for Windows and is the best choice for most users.
Open your
yazi.tomland add this block:[manager] shell = ["powershell", "-c"]Explanation:
shell = [...]: This tells Yazi which program to use to execute commands."powershell": The command to run PowerShell."-c": This is the flag for PowerShell that means "execute the following command string."
Option B: Use Command Prompt (
cmd.exe)If you prefer the classic Command Prompt, you can use this configuration instead.
Open your
yazi.tomland add this block:[manager] shell = ["cmd", "/c"]Explanation:
"cmd": The command to run the Command Prompt."/c": This is the flag forcmd.exethat means "Carries out the command specified by the string and then terminates." (Note the forward slash/instead of a dash-).
Step 3: Save and Restart
- Save the
yazi.tomlfile. - Completely close your terminal and Yazi.
- Re-open Yazi.
Now, when you press
:to enter a command and typeecho "test", it should work correctly and you will see "test" printed at the bottom of the screen withprocess exited with status code 0(which means success).Summary
The issue is that Yazi doesn't know it needs to use a Windows-specific shell. By creating a
yazi.tomlfile at%APPDATA%\yazi\config\yazi.tomland adding one of the following snippets, you fix the problem.For PowerShell (recommended):
[manager] shell = ["powershell", "-c"]For Command Prompt:
[manager] shell = ["cmd", "/c"]
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.