📝 Docs: 添加 Windows Powershell 设置环境变量方法 (#2874)

Co-authored-by: Ju4tCode <42488585+yanyongyu@users.noreply.github.com>
This commit is contained in:
Leo Q 2024-08-13 15:38:17 +08:00 committed by GitHub
parent d05c90787c
commit 75f5825cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 132 additions and 48 deletions

View File

@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
同时,设置环境变量: 同时,设置环境变量:
```bash ```bash
# windows # windows cmd
set CUSTOM_CONFIG "config in environment variables" set CUSTOM_CONFIG 'config in environment variables'
# windows powershell
$Env:CUSTOM_CONFIG='config in environment variables'
# linux/macOS # linux/macOS
export CUSTOM_CONFIG="config in environment variables" export CUSTOM_CONFIG='config in environment variables'
``` ```
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。 那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set DRIVER '~fastapi+~httpx+~websockets' set DRIVER '~fastapi+~httpx+~websockets'
# windows powershell
$Env:DRIVER='~fastapi+~httpx+~websockets'
# linux/macOS # linux/macOS
export DRIVER='~fastapi+~httpx+~websockets' export DRIVER='~fastapi+~httpx+~websockets'
``` ```
@ -331,8 +335,10 @@ HOST=127.0.0.1
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set HOST '127.0.0.1' set HOST '127.0.0.1'
# windows powershell
$Env:HOST='127.0.0.1'
# linux/macOS # linux/macOS
export HOST='127.0.0.1' export HOST='127.0.0.1'
``` ```
@ -367,8 +373,10 @@ PORT=8080
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set PORT '8080' set PORT '8080'
# windows powershell
$Env:PORT='8080'
# linux/macOS # linux/macOS
export PORT='8080' export PORT='8080'
``` ```
@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set LOG_LEVEL 'DEBUG' set LOG_LEVEL 'DEBUG'
# windows powershell
$Env:LOG_LEVEL='DEBUG'
# linux/macOS # linux/macOS
export LOG_LEVEL='DEBUG' export LOG_LEVEL='DEBUG'
``` ```
@ -443,8 +453,10 @@ API_TIMEOUT=10.0
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set API_TIMEOUT '10.0' set API_TIMEOUT '10.0'
# windows powershell
$Env:API_TIMEOUT='10.0'
# linux/macOS # linux/macOS
export API_TIMEOUT='10.0' export API_TIMEOUT='10.0'
``` ```
@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SUPERUSERS '["123123123"]' set SUPERUSERS '["123123123"]'
# windows powershell
$Env:SUPERUSERS='["123123123"]'
# linux/macOS # linux/macOS
export SUPERUSERS='["123123123"]' export SUPERUSERS='["123123123"]'
``` ```
@ -515,8 +529,10 @@ NICKNAME=["bot"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set NICKNAME '["bot"]' set NICKNAME '["bot"]'
# windows powershell
$Env:NICKNAME='["bot"]'
# linux/macOS # linux/macOS
export NICKNAME='["bot"]' export NICKNAME='["bot"]'
``` ```
@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set COMMAND_START '["/", ""]' set COMMAND_START '["/", ""]'
set COMMAND_SEP '[".", " "]' set COMMAND_SEP '[".", " "]'
# windows powershell
$Env:COMMAND_START='["/", ""]'
$Env:COMMAND_SEP='[".", " "]'
# linux/macOS # linux/macOS
export COMMAND_START='["/", ""]' export COMMAND_START='["/", ""]'
export COMMAND_SEP='[".", " "]' export COMMAND_SEP='[".", " "]'
@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SESSION_EXPIRE_TIMEOUT '00:02:00' set SESSION_EXPIRE_TIMEOUT '00:02:00'
# windows powershell
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
# linux/macOS # linux/macOS
export SESSION_EXPIRE_TIMEOUT='00:02:00' export SESSION_EXPIRE_TIMEOUT='00:02:00'
``` ```

View File

@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
同时,设置环境变量: 同时,设置环境变量:
```bash ```bash
# windows # windows cmd
set CUSTOM_CONFIG "config in environment variables" set CUSTOM_CONFIG 'config in environment variables'
# windows powershell
$Env:CUSTOM_CONFIG='config in environment variables'
# linux/macOS # linux/macOS
export CUSTOM_CONFIG="config in environment variables" export CUSTOM_CONFIG='config in environment variables'
``` ```
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。 那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set DRIVER '~fastapi+~httpx+~websockets' set DRIVER '~fastapi+~httpx+~websockets'
# windows powershell
$Env:DRIVER='~fastapi+~httpx+~websockets'
# linux/macOS # linux/macOS
export DRIVER='~fastapi+~httpx+~websockets' export DRIVER='~fastapi+~httpx+~websockets'
``` ```
@ -331,8 +335,10 @@ HOST=127.0.0.1
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set HOST '127.0.0.1' set HOST '127.0.0.1'
# windows powershell
$Env:HOST='127.0.0.1'
# linux/macOS # linux/macOS
export HOST='127.0.0.1' export HOST='127.0.0.1'
``` ```
@ -367,8 +373,10 @@ PORT=8080
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set PORT '8080' set PORT '8080'
# windows powershell
$Env:PORT='8080'
# linux/macOS # linux/macOS
export PORT='8080' export PORT='8080'
``` ```
@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set LOG_LEVEL 'DEBUG' set LOG_LEVEL 'DEBUG'
# windows powershell
$Env:LOG_LEVEL='DEBUG'
# linux/macOS # linux/macOS
export LOG_LEVEL='DEBUG' export LOG_LEVEL='DEBUG'
``` ```
@ -443,8 +453,10 @@ API_TIMEOUT=10.0
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set API_TIMEOUT '10.0' set API_TIMEOUT '10.0'
# windows powershell
$Env:API_TIMEOUT='10.0'
# linux/macOS # linux/macOS
export API_TIMEOUT='10.0' export API_TIMEOUT='10.0'
``` ```
@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SUPERUSERS '["123123123"]' set SUPERUSERS '["123123123"]'
# windows powershell
$Env:SUPERUSERS='["123123123"]'
# linux/macOS # linux/macOS
export SUPERUSERS='["123123123"]' export SUPERUSERS='["123123123"]'
``` ```
@ -515,8 +529,10 @@ NICKNAME=["bot"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set NICKNAME '["bot"]' set NICKNAME '["bot"]'
# windows powershell
$Env:NICKNAME='["bot"]'
# linux/macOS # linux/macOS
export NICKNAME='["bot"]' export NICKNAME='["bot"]'
``` ```
@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set COMMAND_START '["/", ""]' set COMMAND_START '["/", ""]'
set COMMAND_SEP '[".", " "]' set COMMAND_SEP '[".", " "]'
# windows powershell
$Env:COMMAND_START='["/", ""]'
$Env:COMMAND_SEP='[".", " "]'
# linux/macOS # linux/macOS
export COMMAND_START='["/", ""]' export COMMAND_START='["/", ""]'
export COMMAND_SEP='[".", " "]' export COMMAND_SEP='[".", " "]'
@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SESSION_EXPIRE_TIMEOUT '00:02:00' set SESSION_EXPIRE_TIMEOUT '00:02:00'
# windows powershell
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
# linux/macOS # linux/macOS
export SESSION_EXPIRE_TIMEOUT='00:02:00' export SESSION_EXPIRE_TIMEOUT='00:02:00'
``` ```

View File

@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
同时,设置环境变量: 同时,设置环境变量:
```bash ```bash
# windows # windows cmd
set CUSTOM_CONFIG "config in environment variables" set CUSTOM_CONFIG 'config in environment variables'
# windows powershell
$Env:CUSTOM_CONFIG='config in environment variables'
# linux/macOS # linux/macOS
export CUSTOM_CONFIG="config in environment variables" export CUSTOM_CONFIG='config in environment variables'
``` ```
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。 那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set DRIVER '~fastapi+~httpx+~websockets' set DRIVER '~fastapi+~httpx+~websockets'
# windows powershell
$Env:DRIVER='~fastapi+~httpx+~websockets'
# linux/macOS # linux/macOS
export DRIVER='~fastapi+~httpx+~websockets' export DRIVER='~fastapi+~httpx+~websockets'
``` ```
@ -331,8 +335,10 @@ HOST=127.0.0.1
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set HOST '127.0.0.1' set HOST '127.0.0.1'
# windows powershell
$Env:HOST='127.0.0.1'
# linux/macOS # linux/macOS
export HOST='127.0.0.1' export HOST='127.0.0.1'
``` ```
@ -367,8 +373,10 @@ PORT=8080
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set PORT '8080' set PORT '8080'
# windows powershell
$Env:PORT='8080'
# linux/macOS # linux/macOS
export PORT='8080' export PORT='8080'
``` ```
@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set LOG_LEVEL 'DEBUG' set LOG_LEVEL 'DEBUG'
# windows powershell
$Env:LOG_LEVEL='DEBUG'
# linux/macOS # linux/macOS
export LOG_LEVEL='DEBUG' export LOG_LEVEL='DEBUG'
``` ```
@ -443,8 +453,10 @@ API_TIMEOUT=10.0
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set API_TIMEOUT '10.0' set API_TIMEOUT '10.0'
# windows powershell
$Env:API_TIMEOUT='10.0'
# linux/macOS # linux/macOS
export API_TIMEOUT='10.0' export API_TIMEOUT='10.0'
``` ```
@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SUPERUSERS '["123123123"]' set SUPERUSERS '["123123123"]'
# windows powershell
$Env:SUPERUSERS='["123123123"]'
# linux/macOS # linux/macOS
export SUPERUSERS='["123123123"]' export SUPERUSERS='["123123123"]'
``` ```
@ -515,8 +529,10 @@ NICKNAME=["bot"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set NICKNAME '["bot"]' set NICKNAME '["bot"]'
# windows powershell
$Env:NICKNAME='["bot"]'
# linux/macOS # linux/macOS
export NICKNAME='["bot"]' export NICKNAME='["bot"]'
``` ```
@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set COMMAND_START '["/", ""]' set COMMAND_START '["/", ""]'
set COMMAND_SEP '[".", " "]' set COMMAND_SEP '[".", " "]'
# windows powershell
$Env:COMMAND_START='["/", ""]'
$Env:COMMAND_SEP='[".", " "]'
# linux/macOS # linux/macOS
export COMMAND_START='["/", ""]' export COMMAND_START='["/", ""]'
export COMMAND_SEP='[".", " "]' export COMMAND_SEP='[".", " "]'
@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SESSION_EXPIRE_TIMEOUT '00:02:00' set SESSION_EXPIRE_TIMEOUT '00:02:00'
# windows powershell
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
# linux/macOS # linux/macOS
export SESSION_EXPIRE_TIMEOUT='00:02:00' export SESSION_EXPIRE_TIMEOUT='00:02:00'
``` ```

View File

@ -73,10 +73,12 @@ CUSTOM_CONFIG=config in dotenv
同时,设置环境变量: 同时,设置环境变量:
```bash ```bash
# windows # windows cmd
set CUSTOM_CONFIG "config in environment variables" set CUSTOM_CONFIG 'config in environment variables'
# windows powershell
$Env:CUSTOM_CONFIG='config in environment variables'
# linux/macOS # linux/macOS
export CUSTOM_CONFIG="config in environment variables" export CUSTOM_CONFIG='config in environment variables'
``` ```
那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。 那最终 NoneBot 所读取的内容为环境变量中的内容,即 `config in environment variables`。
@ -295,8 +297,10 @@ DRIVER=~fastapi+~httpx+~websockets
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set DRIVER '~fastapi+~httpx+~websockets' set DRIVER '~fastapi+~httpx+~websockets'
# windows powershell
$Env:DRIVER='~fastapi+~httpx+~websockets'
# linux/macOS # linux/macOS
export DRIVER='~fastapi+~httpx+~websockets' export DRIVER='~fastapi+~httpx+~websockets'
``` ```
@ -331,8 +335,10 @@ HOST=127.0.0.1
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set HOST '127.0.0.1' set HOST '127.0.0.1'
# windows powershell
$Env:HOST='127.0.0.1'
# linux/macOS # linux/macOS
export HOST='127.0.0.1' export HOST='127.0.0.1'
``` ```
@ -367,8 +373,10 @@ PORT=8080
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set PORT '8080' set PORT '8080'
# windows powershell
$Env:PORT='8080'
# linux/macOS # linux/macOS
export PORT='8080' export PORT='8080'
``` ```
@ -407,8 +415,10 @@ LOG_LEVEL=DEBUG
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set LOG_LEVEL 'DEBUG' set LOG_LEVEL 'DEBUG'
# windows powershell
$Env:LOG_LEVEL='DEBUG'
# linux/macOS # linux/macOS
export LOG_LEVEL='DEBUG' export LOG_LEVEL='DEBUG'
``` ```
@ -443,8 +453,10 @@ API_TIMEOUT=10.0
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set API_TIMEOUT '10.0' set API_TIMEOUT '10.0'
# windows powershell
$Env:API_TIMEOUT='10.0'
# linux/macOS # linux/macOS
export API_TIMEOUT='10.0' export API_TIMEOUT='10.0'
``` ```
@ -479,8 +491,10 @@ SUPERUSERS=["123123123"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SUPERUSERS '["123123123"]' set SUPERUSERS '["123123123"]'
# windows powershell
$Env:SUPERUSERS='["123123123"]'
# linux/macOS # linux/macOS
export SUPERUSERS='["123123123"]' export SUPERUSERS='["123123123"]'
``` ```
@ -515,8 +529,10 @@ NICKNAME=["bot"]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set NICKNAME '["bot"]' set NICKNAME '["bot"]'
# windows powershell
$Env:NICKNAME='["bot"]'
# linux/macOS # linux/macOS
export NICKNAME='["bot"]' export NICKNAME='["bot"]'
``` ```
@ -554,9 +570,12 @@ COMMAND_SEP=[".", " "]
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set COMMAND_START '["/", ""]' set COMMAND_START '["/", ""]'
set COMMAND_SEP '[".", " "]' set COMMAND_SEP '[".", " "]'
# windows powershell
$Env:COMMAND_START='["/", ""]'
$Env:COMMAND_SEP='[".", " "]'
# linux/macOS # linux/macOS
export COMMAND_START='["/", ""]' export COMMAND_START='["/", ""]'
export COMMAND_SEP='[".", " "]' export COMMAND_SEP='[".", " "]'
@ -592,8 +611,10 @@ SESSION_EXPIRE_TIMEOUT=00:02:00
<TabItem value="env" label="系统环境变量"> <TabItem value="env" label="系统环境变量">
```bash ```bash
# windows # windows cmd
set SESSION_EXPIRE_TIMEOUT '00:02:00' set SESSION_EXPIRE_TIMEOUT '00:02:00'
# windows powershell
$Env:SESSION_EXPIRE_TIMEOUT='00:02:00'
# linux/macOS # linux/macOS
export SESSION_EXPIRE_TIMEOUT='00:02:00' export SESSION_EXPIRE_TIMEOUT='00:02:00'
``` ```