Schniz / fnm

🚀 Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
18.27k stars 468 forks source link

Windows cmder run fnm use on startup #1113

Open Harpush opened 6 months ago

Harpush commented 6 months ago

Currently on windows cmder with --use-on-cd - fnm use doesn't run when opening a console in a folder with .nvmrc file. Is there any way to make it work automatically in cmder?

sanbeichahegongheguo commented 3 months ago

try this:

Windows Command Prompt aka Batch aka WinCMD fnm is also supported but is not entirely covered. You can set up a startup script and append the following lines:

@echo off :: for /F will launch a new instance of cmd so we create a guard to prevent an infnite loop if not defined FNM_AUTORUN_GUARD ( set "FNM_AUTORUN_GUARD=AutorunGuard" FOR /f "tokens=*" %%z IN ('fnm env --use-on-cd') DO CALL %%z )