Skip to content

Commit

Permalink
docs: add a single-line command to update the PowerShell profile (#308)
Browse files Browse the repository at this point in the history
Co-authored-by: 野声 <artin@cat.ms>
  • Loading branch information
Bryan Acosta and bytemain authored Jun 20, 2024
1 parent 2d4a66c commit 37804da
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 44 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ echo 'eval "$(vfox activate zsh)"' >> ~/.zshrc
echo 'vfox activate fish | source' >> ~/.config/fish/config.fish

# For PowerShell:
# 1. Open PowerShell Profile:
New-Item -Type File -Path $PROFILE # Just ignore the 'file already exists' error.
Invoke-Item $PROFILE
# 2. Add the following line to the end of your $PROFILE and save:
Invoke-Expression "$(vfox activate pwsh)"
if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"'

# For Clink:
# 1. Install clink: https://github.com/chrisant996/clink/releases
Expand Down
8 changes: 2 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,8 @@ echo 'eval "$(vfox activate bash)"' >> ~/.bashrc
echo 'eval "$(vfox activate zsh)"' >> ~/.zshrc
echo 'vfox activate fish | source' >> ~/.config/fish/config.fish

# PowerShell:
# 1. 打开 PowerShell 配置文件:
New-Item -Type File -Path $PROFILE # 无需在意 `文件已存在` 错误
Invoke-Item $PROFILE
# 2. 将下面一行添加到你的 $PROFILE 文件末尾并保存:
Invoke-Expression "$(vfox activate pwsh)"
# 对于 PowerShell
if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"'

# Clink:
# 1. 安装 clink: https://github.com/chrisant996/clink/releases
Expand Down
21 changes: 4 additions & 17 deletions docs/guides/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,13 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish

:::

::: details Powershell
::: details PowerShell

Open PowerShell Profile:

```shell
New-Item -Type File -Path $PROFILE # Just ignore the 'file already exists' error.

# If it prompts "Unable to find the path", then you need to forcefully create profile. Add the "-Force" option.
# New-Item -Type File -Path $PROFILE –Force

Invoke-Item $PROFILE # open Profile
```

Add the following line to the end of your profile and save:

```shell
Invoke-Expression "$(vfox activate pwsh)"
```PowerShell
if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"'
```

If Powershell prompts:`cannot be loaded because the execution of scripts is disabled on this system`.**Open PowerShell** with **Run as Administrator**.Then, run this command in PowerShell
If PowerShell prompts: `cannot be loaded because the execution of scripts is disabled on this system`.**Open PowerShell** with **Run as Administrator**.Then, run this command in PowerShell

```shell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Expand Down
21 changes: 5 additions & 16 deletions docs/zh-hans/guides/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,30 +104,19 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish

:::

::: details Powershell
::: details PowerShell

打开 PowerShell 配置文件:
创建 PowerShell 配置:

```shell
New-Item -Type File -Path $PROFILE # 无需在意 `文件已存在` 错误

# 如果它提示未能找到路径,那么你需要强制创建profile。添加"-Force"选项。
# New-Item -Type File -Path $PROFILE –Force

Invoke-Item $PROFILE # 打开profile
```

将下面一行添加到你的 $PROFILE 文件末尾并保存:

```shell
Invoke-Expression "$(vfox activate pwsh)"
if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"'
```
如果powershell提示`在此系统上禁止运行脚本`,那么请你**以管理员身份重新运行powershell**输入如下命令
如果 PowerShell 提示`在此系统上禁止运行脚本`,那么请你**以管理员身份重新运行 PowerShell**输入如下命令
```shell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
# 之后输入Y,按回车
# 之后输入 Y,按回车
y
```
Expand Down

0 comments on commit 37804da

Please sign in to comment.