Skip to content

Instantly share code, notes, and snippets.

@SG60
Created December 28, 2021 17:40
Show Gist options
  • Select an option

  • Save SG60/537b7c7638f67fe4d5564bd101848c36 to your computer and use it in GitHub Desktop.

Select an option

Save SG60/537b7c7638f67fe4d5564bd101848c36 to your computer and use it in GitHub Desktop.
Neovide WSL Launcher Script
param($p1)
C:\Path\To\neovide.exe --wsl "$(wsl wslpath -ua $p1)"
@echo off
pwsh -F C:\Path\To\neovide-launcher-pwsh.ps1 %1
@AndASM
Copy link

AndASM commented Jan 20, 2022

You can do it all within batch, I'm sure someone who knows the language can do better. But I managed a mostly working version. It even handles files with ' in their names and the ~ shortcut for the user's home directory.

neovide.bat

@echo off
setlocal enabledelayedexpansion
set "WinPath=%*"
set "WinPath=!WinPath:*~=%USERPROFILE%!"
set "WinPath=%WinPath:|=%"
set "WinPath=%WinPath:\=/%"
for /f "usebackq tokens=*" %%a in (`wsl wslpath -ua '%WinPath:'='\''%'`) do set "WinPath=%%a"
C:\Path\To\neovide.exe --wsl '%WinPath:'='\''%'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment