SuperAPI AI Directory

windows-open

General & other

View repository

Updated 10-16 06:44

About this skill

Windows Open File/URL/Application

Use PowerShell and system commands to open files, URLs, folders, and applications. Equivalent to macOS's open command.

Use Cases

  • User says "open this file", "open with XX", "open that webpage"
  • Need to locate a file in File Explorer
  • Need to launch a specific application
  • Show the file to the user for viewing after file processing is complete

Command Reference

Open File (Default Application)

# 用默认应用打开文件
Start-Process "C:\Users\$env:USERNAME\Documents\report.xlsx"
Or use Invoke-Item

Invoke-Item "C:\Users$env:USERNAME\Desktop\photo.jpg"


### 用指定应用打开

```powershell
# 用记事本打开
Start-Process "notepad.exe" -ArgumentList "C:\path\to\file.txt"

# 用 VS Code 打开
Start-Process "code" -ArgumentList "C:\path\to\project"

# 用 Word 打开
Start-Process "winword.exe" -ArgumentList "C:\path\to\doc.docx"

# 用 Excel 打开
Start-Process "excel.exe" -ArgumentList "C:\path\to\data.xlsx"

Open URL

# 用默认浏览器打开
Start-Process "https://www.example.com"

# 用指定浏览器打开
Start-Process "chrome.exe" -ArgumentList "https://www.example.com"
Start-Process "msedge.exe" -ArgumentList "https://www.example.com"

Open Folder

# 打开文件夹
explorer.exe "C:\Users\$env:USERNAME\Documents"

# 打开文件并选中(在资源管理器中高亮)
explorer.exe /select, "C:\Users\$env:USERNAME\Documents\report.xlsx"

# 打开特殊文件夹
explorer.exe shell:Downloads    # 下载
explorer.exe shell:Desktop      # 桌面
explorer.exe shell:MyDocuments  # 文档
explorer.exe shell:MyPictures   # 图片
explorer.exe shell:MyMusic      # 音乐
explorer.exe shell:MyVideo      # 视频
explorer.exe shell:RecycleBinFolder  # 回收站

Launch Application

# 按名称启动(需要在 PATH 中)
Start-Process "notepad"
Start-Process "calc"
Start-Process "mspaint"

# 启动 UWP 应用(通过 URI 协议)
Start-Process "ms-settings:"           # 设置
Start-Process "ms-clock:"              # 时钟
Start-Process "ms-todo:"               # To Do
Start-Process "ms-photos:"             # 照片
Start-Process "ms-screenclip:"         # 截图工具
Start-Process "calculator:"            # 计算器

# 启动并等待关闭
Start-Process "notepad.exe" -ArgumentList "file.txt" -Wait

System Control Panel

# 打开控制面板项
Start-Process "control" -ArgumentList "printers"      # 打印机
Start-Process "control" -ArgumentList "fonts"          # 字体
Start-Process "ncpa.cpl"                               # 网络连接
Start-Process "appwiz.cpl"                             # 程序和功能
Start-Process "devmgmt.msc"                            # 设备管理器

# 打开系统信息
Start-Process "msinfo32"

# 打开任务管理器
Start-Process "taskmgr"

Common File Types → Recommended Opening Methods

File Type Default Method Recommended Specified Application
.txt .md .log Notepad VS Code / Notepad++
.xlsx .csv Excel Excel / LibreOffice
.docx Word Word / LibreOffice
.pdf Edge Adobe Acrobat / SumatraPDF
.jpg .png Photos Photos / Paint
.mp4 .mkv Movies & TV VLC / PotPlayer
.zip .7z File Explorer 7-Zip

Output Specifications

  • After opening, tell the user "Opened the XX file with XX"
  • When opening a folder, state the full path
  • If the file does not exist, prompt and suggest searching

Security Rules

  • Do not open executable files (.exe .bat .cmd .ps1): unless the user explicitly requests it
  • Do not launch applications as administrator: unless the user explicitly requests it
  • Confirm the domain before opening a user-specified URL