docs: update doc for have.bat

This commit is contained in:
xiazeyu_2011 2018-05-18 20:34:10 +08:00
parent bf6dae4a24
commit add82a247b
No known key found for this signature in database
GPG Key ID: F8162BE75DCCDC2D

View File

@ -236,6 +236,68 @@ Uncomment and edit the below line in the script to use Cmder config even when la
# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder. # CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder.
``` ```
### Handling with custom arguments when using init.bat
You can pass custom arguments to `init.bat` and use `have.bat` (or `have` for shortcut) to detect it.
It is useful when you have multiple modes to execute cmder.
If you use
```batch
init.bat /startNotepad
```
to start init.bat with custom argument(`/startNotepad`) and put
```batch
call have "/startNotepad" "cmd /c start notepad.exe"`
```
into `/config/user-profile.cmd`, then `notepad.exe` will be executed, and once you use
```batch
init.bat
```
the `notepad.exe` won't be executed.
Detailed usage of `have` can be seen by typing `have /?` in cmder.
This feature is usually for external execution.
In my case, I use `cmder` as an **entry point** of my portable working system,
and I [integrated VSCode with cmder](https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration), it will **automatic execute VSCode** when I use `cmder.exe` to start.
And when using integrated console in VSCode, VSCode **won't be executed again** as I use
```json
"terminal.integrated.shellArgs.windows": [
"/k",
"%cmder_root%\\vendor\\init.bat",
"/noautorun"
],
```
for `terminal.integrated.shellArgs.windows`,
And here's the related fragment of my `user-profile.cmd`:
```batch
call have NOT "/noautorun" "cmd /c "start %cmder_root%\bin\vsCode\Code.exe --user-data-dir %vsCodeUserData% --extensions-dir %vsCodeExtensionsDir% %* %vsCodeUserData%\code.code-workspace"
```
## Upgrading ## Upgrading
The process of upgrading Cmder depends on the version/build you are currently running The process of upgrading Cmder depends on the version/build you are currently running