Browse Source

Updated README.md => Fixed infite Loop from Windows console startup script (#1124)

This startup script does not produce the error "i was unexpected at this time" and also won't freeze the console because of an infite loop => "for /F" will launch a new instance of cmd.
remotes/origin/use-bnz
Ulf Kamp 9 months ago committed by GitHub
parent
commit
990f3d06cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      README.md

12
README.md

@ -178,16 +178,20 @@ fnm env --use-on-cd | Out-String | Invoke-Expression
```powershell ```powershell
notepad $profile notepad $profile
``` ```
#### Windows Command Prompt aka Batch aka WinCMD #### Windows Command Prompt aka Batch aka WinCMD
fnm is also supported but is not entirely covered. [You can set up a startup script](https://superuser.com/a/144348) and append the following line: fnm is also supported but is not entirely covered. [You can set up a startup script](https://superuser.com/a/144348) and append the following lines:
```batch ```batch
FOR /f "tokens=*" %i IN ('fnm env --use-on-cd') DO CALL %i @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
)
``` ```
If you get the error `i was unexpected at this time`, please make a .cmd file as suggested by the first step in the Usage with Cmder secton add it's path to the `AutoRun` registry key.
#### Usage with Cmder #### Usage with Cmder
Usage is very similar to the normal WinCMD install, apart for a few tweaks to allow being called from the cmder startup script. The example **assumes** that the `CMDER_ROOT` environment variable is **set** to the **root directory** of your Cmder installation. Usage is very similar to the normal WinCMD install, apart for a few tweaks to allow being called from the cmder startup script. The example **assumes** that the `CMDER_ROOT` environment variable is **set** to the **root directory** of your Cmder installation.

Loading…
Cancel
Save