WSL ↔ Windows Cross-System Bridge
Seamless access to Windows Python, PowerShell, CMD, and filesystem from WSL2.
Features
| Command | Purpose |
|---|---|
win-python | Invoke Windows Python (Anaconda or any) |
win-ps | Execute PowerShell commands |
win-cmd | Execute CMD commands |
win-copy | Copy files between WSL and Windows |
win-run-py | Run .py scripts with logging |
win-path | Convert paths WSL /mnt/* ↔ Windows D:\* |
Requirements
- WSL2 (Ubuntu 20.04+)
- Windows 10 or Windows 11
- Windows Python (Anaconda recommended)
- PowerShell
First-Time Setup
cd ~/.openclaw/workspace/skillpublish/wsl-windows-bridge/scripts/
bash setup.sh
The setup script will:
- Auto-detect your Windows Python location (supports
/mnt/d,/mnt/c,/mnt/e) - Copy all wrappers to
~/.openclaw/bin/ - Generate
~/.openclaw/env.windows.shwith correct paths - Set permissions and run verification
Manual setup (without setup.sh):
cp -r scripts/* ~/.openclaw/bin/
chmod +x ~/.openclaw/bin/win-*
# Then manually edit env.windows.sh to set correct paths
Quick Start
Basic Usage
⚠️ exec non-interactive shell note:
# Recommended for exec environment
source ~/.bashrc && source ~/.openclaw/env.windows.sh && win-python ...
# Or directly (wrappers handle .bashrc internally)
~/.openclaw/bin/win-python ...
Common Scenarios
Invoke Windows Python to run a script:
source ~/.bashrc && source ~/.openclaw/env.windows.sh
# Single-line command
win-python -c "import xtquant; print(xtquant.__version__)"
# Run a script file
win-python "$WIN_SCRIPTS/my_task.py" --arg value
Execute PowerShell:
win-ps "Get-Process python | Select-Object Name,Id | Format-Table"
win-ps "Get-Service | Where-Object {\$_.DisplayName -like '*QMT*'}"
File copy:
win-copy /tmp/result.csv /mnt/d/app/output/result.csv
Path conversion:
win-path /mnt/d/app
# → D:\app
win-path --to-wsl D:\app
# → /mnt/d/app
Quantitative Trading Example (QMT/xtquant)
source ~/.bashrc && source ~/.openclaw/env.windows.sh
# Get HS300 constituent stocks
win-python -c "
from xtquant import xtdata
stocks = xtdata.get_stock_list_in_sector('沪深300')
print(f'HS300: {len(stocks)} stocks')
print(stocks[:5])
"
# Download historical data
win-python -c "
from xtquant import xtdata
xtdata.download_history_data('600000.SH', start_time='20260101', end_time='20260405')
print('Download complete')
"
Environment Variables
| Variable | Default | Description |
|---|---|---|
WIN_ROOT | /mnt/d | Windows root directory |
WIN_ANACONDA | /mnt/d/app/anaconda | Anaconda installation path |
WIN_PYTHON | $WIN_ANACONDA/python.exe | Python executable |
WIN_PS | .../powershell.exe | PowerShell path |
WIN_SCRIPTS | /mnt/d/app/scripts | Common scripts directory |
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
command not found: win-python | env.windows.sh not sourced | source ~/.bashrc && source ~/.openclaw/env.windows.sh |
Permission denied | UAC permission | Use D:\app\ or user directory as target |
| Chinese garbled logs | QMT log encoding | Ignore; actual data is correct |
File Structure
~/.openclaw/workspace/skillpublish/wsl-windows-bridge/
├── SKILL.md
├── _meta.json
├── README.md
└── scripts/
├── setup.sh ← Auto-install (auto-detects Python path)
├── env.windows.sh ← Template (setup.sh generates actual config)
├── win-python
├── win-ps
├── win-cmd
├── win-copy
├── win-run-py
└── win-path
Maintenance
- Author: @DEACONHAN
- Version: 0.1.0 (draft)
- Issues: https://github.com/jarvis-agent/wsl-windows-bridge/issues