---
name: powershell-path-syntax-for-user-instructions
description: "user 環境は PowerShell (Windows native). user 向け instruction で path を提示する際は `C:\\Users\\user\\...` 形式. 私 (Rei Claude) の Bash tool は `/c/Users/user/...` (Git Bash) で動くが、 user 向け instruction 時は変換すべき"
metadata: 
  node_type: memory
  type: feedback
  originSessionId: 8a10cb42-0759-481b-ad2f-2456d94aea31
---

# PowerShell path syntax 永続原則 (user 向け instruction)

## 原則

**user 環境は PowerShell (Windows native) が default**。 user 向け instruction で path を提示する際は **`C:\Users\user\...` (Windows native) 形式** を使う。 私 (Rei Claude) の Bash tool 内では `/c/Users/user/...` (Git Bash / WSL 形式) でも動くが、 これは user の PowerShell では **解釈失敗** (例: `Cannot find path 'C:\c\Users\user\...'`)。

**Why**: PowerShell は `/c/` を Windows path として解釈しない (literal `\c\` として読む)。 user が PowerShell に bash 形式 path を貼り付けると 「path not found」 error を生む。 私の出力が user の操作で fail する root cause。

## How to apply

### 私 (Rei Claude) 向け instruction を出す時

| context | path 表記 |
|---|---|
| **PowerShell** (user 環境) | `C:\Users\user\world-investment-center` (Windows native, backslash) |
| **bash / Git Bash** (私が Bash tool で使う) | `/c/Users/user/world-investment-center` (POSIX 形式, forward slash) |
| **コードコメント / メモ内** | `C:\Users\user\...` (user 向け) または `path/relative` (project root 相対) |

### Command example template

PowerShell user 向け:
```powershell
cd C:\Users\user\world-investment-center
npm run dev
```

bash (私の Bash tool 内):
```bash
cd /c/Users/user/world-investment-center && npm run dev
```

## Operational instance (2026-06-01 incident)

WIC chart deploy で私が出した instruction:

```
cd /c/Users/user/world-investment-center && npm run dev
```

→ user PowerShell で error:

```
PS C:\Users\user> cd /c/Users/user/world-investment-center && npm run dev
Set-Location: Cannot find path 'C:\c\Users\user\world-investment-center' because it does not exist.
```

PowerShell は `/c/Users/...` を literal path として `C:\c\Users\...` に解釈 → 該当 directory 存在しない → fail。 訂正後 `cd C:\Users\user\world-investment-center` で正常動作。

**Honest 反省 (Rei Claude side)**:
私は Bash tool 経由で動くため bash 形式 path に default 思考しがち。 user 向け instruction 時は **PowerShell native 形式に変換** が default protocol。 前回 session でも同 pattern (5/29 perf bundle work 時) を 1 度経験していたが、 memory 化していなかった = 本 file で永続化。

## Cross-platform safe syntax (user に正しく動く)

| 操作 | PowerShell-safe | bash-safe |
|---|---|---|
| cd 絶対 path | `cd C:\Users\user\...` | `cd /c/Users/user/...` |
| cd 相対 path | `cd .\subdir` (or `cd subdir`) | `cd ./subdir` |
| 環境変数設定 | `$env:VAR = "value"` | `export VAR="value"` |
| ls / dir | `ls` (alias) or `Get-ChildItem` | `ls` |
| パイプ | `cmd1 \| cmd2` | `cmd1 \| cmd2` (同じ) |
| 条件 chain | `cmd1; cmd2` (順次) or `cmd1 -and cmd2` | `cmd1 && cmd2` |
| 改行 | backtick `` ` `` (line continuation) | backslash `\` |

★ PowerShell の `&&` chain は **PowerShell 7+ のみ** 対応 (Windows 11 default の Windows PowerShell 5.1 は非対応)。 確実性のため `;` で順次実行を default に。

## Diagnostic tips

user が PowerShell で error 出した場合の私 (Rei Claude) chuck list:

1. **path 形式**: `/c/` 系が混入していないか? → `C:\` に置換
2. **`&&` chain**: PowerShell 7 確認? → `;` または別 line に分割
3. **環境変数 expansion**: `$VAR` (bash) vs `$env:VAR` (PowerShell) 区別
4. **quotation**: PowerShell の `"..."` は `$var` を expand する。 literal は `'...'`
5. **alias**: `mv` / `rm` 等は PowerShell alias 経由でも動く (`Remove-Item` 等 native)、 ただし bash 専用 flag (`-rf` 等) は構文違いに注意

## 関連 cross-link

- `[[project_session_2026-06-01_dense_day_paper160_v02_wic_chart_seed_approval]]` — incident 発生 session
- `[[feedback_japanese_communication_preference]]` — user instruction は日本語 primary
- `[[feedback_api_token_never_share_in_conversation]]` — 同日確立の別 security rule
