#How do I start warp in a specific directory?

30 messages · Page 1 of 1 (latest)

tribal cave
#

How do I start warp in a specific directory? So that the the current working directory in warp is the specified one.

mystic anchorBOT
#

Hi @tribal cave. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To start Warp in a specific directory, the knowledge sources indicate that Warp does not currently support a direct command-line argument like warp <directory> to set the working directory on launch. However, there are workarounds using Warp's URI scheme and custom scripts.

Workarounds

1. Using the URI Scheme

Warp supports a URI scheme that allows you to open a new window or tab in a specific directory. For example:

  • Open a new window in a directory:
    warp://action/new_window?path=<path_to_folder>
    
  • Open a new tab in a directory:
    warp://action/new_tab?path=<path_to_folder>
    

On macOS, you can use the open command in a shell function:

openwarp() {
  open "warp://action/new_tab?path=$(pwd)" &
}

On Linux, you can use:

openwarp() {
  nohup warp-terminal warp://action/new_tab?path=$(pwd) &
}

This will open a new Warp tab in the current directory when you run openwarp from your terminal. You can adapt these scripts to your workflow or file manager integration as needed. More details on the URI scheme are available in the Warp documentation and in user discussions here.

2. File Manager Integration

For file managers like Nautilus or context menu integrations, you can create a script that launches Warp using the URI scheme with the selected directory as the path. Example scripts and approaches are discussed in several issues, such as this one.

3. VSCode Integration

#

If you want to open Warp from VSCode in the current workspace directory, you can create a small script (e.g., open-warp) with the following content:

#!/bin/bash
open "warp://action/new_tab?path=$(pwd)"

Make it executable and set it as your external terminal in VSCode settings. More details are available here.


Note: If Warp is not already running, some users report that the first launch may not respect the directory, but subsequent launches do. This is a known issue and is being tracked by the Warp team.

If you need more advanced session management, you can also look into Warp's Launch Configurations, which allow you to set up windows, tabs, and panes with specific working directories.


In summary:
Warp does not natively support a direct command-line argument for the working directory, but you can use the URI scheme and custom scripts as a workaround to open Warp in a specific directory.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tribal cave Kapa.ai is still learning and improving, please let me know how I did by reacting below.

tribal cave
#

@mystic anchor On Windows

mystic anchorBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

On Windows, Warp does not currently support a direct command-line argument like warp.exe <directory> to start in a specific directory. However, you can use Warp's URI scheme as a workaround to open a new window or tab in a specified directory.

How to Start Warp in a Specific Directory on Windows

Using the URI Scheme

You can use the following URI to open a new window or tab in a specific directory:

  • Open new window:
    warp://action/new_window?path=<path_to_folder>
    
  • Open new tab:
    warp://action/new_tab?path=<path_to_folder>
    

To use this from a script or context menu, you can run (for example, from Command Prompt or a batch file):

start "" "warp://action/new_window?path=C:\Your\Target\Directory"

Context Menu Integration

Some users have created context menu entries or used tools like Nilesoft Shell to add "Open Warp Here" to the right-click menu. The recommended approach is to use a batch file that receives the directory as an argument and then launches Warp with the URI scheme. For example:

Batch file (open-warp-here.bat):

@echo off
start "" "warp://action/new_window?path=%~1"

Then, configure your context menu or shell extension to call this batch file with the selected directory as the argument. More details and user examples can be found in this discussion.

Limitations

  • If Warp is not already running, the first launch may not always respect the directory, but subsequent launches usually do. This is a known issue being tracked by the Warp team see here.
  • Direct command-line arguments to warp.exe for setting the working directory are not currently supported.
#

For more details on the URI scheme, see the Warp documentation.


Summary:
On Windows, use the warp://action/new_window?path=... or warp://action/new_tab?path=... URI scheme to open Warp in a specific directory. There is no direct command-line argument for this yet, but context menu and scripting workarounds are possible using the URI scheme and batch files.
Source: Warp and Nilesoft shell | Source: Allow launching Warp in a specified working directory

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tribal cave Kapa.ai is still learning and improving, please let me know how I did by reacting below.

tribal cave
#

@mystic anchor Using this batch file does not bring the window of terminal into the forgound.

mystic anchorBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

You're correct—according to the knowledge sources, using a batch file to launch Warp via the URI scheme (e.g., with start "" "warp://action/new_window?path=...") does not guarantee that the new Warp window will be brought to the foreground or focused automatically. This limitation is mentioned by users who have tried similar approaches for context menu integration and scripting on Windows. There is no official workaround documented in the sources to force the Warp window to the foreground when launched this way.

Additionally, there are related feature requests for improved focus behavior, especially in scenarios like Quake mode or when opening new windows, but these are not yet resolved or implemented in Warp for Windows. Users have expressed the need for Warp to grab focus when opened, but as of now, this remains an open issue and a known limitationWarp and Nilesoft shell Windows: Warp should always grab focus when opening via quake mode.

In summary:
There is currently no documented way in the knowledge sources to ensure that launching Warp via a batch file or URI scheme on Windows will bring the window to the foreground. This is a known limitation, and the Warp team is aware of related focus issues.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tribal cave Kapa.ai is still learning and improving, please let me know how I did by reacting below.

tribal cave
#

@mystic anchor Can I make it open a new tab instead of a new windows each time I run the batch file?

mystic anchorBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Based on the knowledge sources, you can use Warp’s URI scheme to open a new tab in an existing Warp window by using the following URI:

warp://action/new_tab?path=<path_to_folder>

However, on Windows, running this URI (for example, via a batch file with start "" "warp://action/new_tab?path=...") will not necessarily open the new tab in an already open Warp window. Instead, it may still open a new window each time. This is a known limitation and has been reported by users on both Linux and Windows. The current behavior is that Warp does not check for active instances and does not automatically open a new tab in an existing window when launched via the URI scheme or context menu integration. This issue is being tracked by the Warp team, but as of now, there is no built-in way to force new tabs to open in the same window programmatically on Windows ‘Open in Warp’ does not check for active instances | Discord: Can new warp instances automatically be new tabs when opened?.

Summary:
You can use the URI scheme for new tabs, but on Windows, there is currently no way to guarantee that a new tab will open in an existing Warp window instead of a new window each time you run the batch file. This is a known limitation.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tribal cave Kapa.ai is still learning and improving, please let me know how I did by reacting below.

tribal cave
#

@mystic anchor What if Warp is not yet open, will it open a new window with new_tab ?

mystic anchorBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

If Warp is not yet open and you use the URI scheme with new_tab (for example, warp://action/new_tab?path=<path_to_folder>), the knowledge sources indicate that Warp will open a new window to accommodate the new tab request. This behavior is consistent with user reports and discussions: when no Warp window is open, triggering a new tab via the URI scheme results in a new window being created, since there is no existing window to add the tab to. This matches the behavior described for both Windows and other platforms see discussion.

So, yes—if Warp is not yet open, using the new_tab URI will open a new window.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tribal cave Kapa.ai is still learning and improving, please let me know how I did by reacting below.

tribal cave
#

@mystic anchor Running the batch file (either with new_tab or new_window) will not open the desired directory if Warp is already open. It will open a new window or tab but its directory is somewhere else.

mystic anchorBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

You are correct—according to the knowledge sources, there are known issues where using the URI scheme (with either new_tab or new_window) does not always open Warp in the desired directory if Warp is already running. Instead, Warp may open a new window or tab, but the working directory may default to the home directory or a previous session's directory, rather than the one specified in the URI.

This inconsistent behavior has been reported by multiple users on both Windows and macOS. For example, users have noted that:

  • When Warp is already open, using the URI scheme sometimes opens a new tab or window in the wrong directory (often the home directory or the last session's directory), not the one specified in the URI or batch file.
  • This issue is particularly problematic for integrations with file managers, context menus, or scripts that expect Warp to always open in the specified directory, regardless of whether it is already running or not.

These issues are documented in several discussions and bug reports, and the Warp team is aware of them. There is currently no official workaround that guarantees the correct directory will always be used when opening new tabs or windows via the URI scheme if Warp is already running Warp and Nilesoft shell Only open a single window when dragging a folder unto the Warp dock icon Launch Warp from terminal in particular directory.

#

Summary:
If Warp is already open, running a batch file with the URI scheme (new_tab or new_window) may not open the new tab or window in the desired directory. This is a known limitation, and the knowledge sources do not provide a reliable solution at this time.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@tribal cave Kapa.ai is still learning and improving, please let me know how I did by reacting below.

tribal cave
mystic anchorBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Yes, you are correct—issue #6386 is the most relevant issue to watch for improvements and updates regarding opening Warp in a specific directory from context menus or scripts on Windows. This issue specifically discusses the challenges and current limitations with using the URI scheme and batch files to open Warp in the desired directory, especially when Warp is already running. It also contains workarounds, user scripts, and direct feedback from the Warp team about the current state and future plans for this feature. If you want to stay updated or contribute feedback, following that issue is the best approach.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: