Skip to content
Back to skills

使用Pyqt4 Qprocess解析Windows符号链接源路径

ASecurity

使用Python 2.7和PyQt4的QProcess模块,通过执行cmd命令`dir /AL`来获取Windows符号链接或目录连接的源路径。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationpython

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill '使用pyqt4-qprocess解析windows符号链接源路径' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 使用Pyqt4 Qprocess解析Windows符号链接源路径?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 使用Pyqt4 Qprocess解析Windows符号链接源路径
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-pyqt4-qprocess-windows/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-pyqt4-qprocess-windows)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "ae2dd8a7-c81c-48d0-80c0-a3f66da9bac9"
name: "使用PyQt4 QProcess解析Windows符号链接源路径"
description: "使用Python 2.7和PyQt4的QProcess模块,通过执行cmd命令`dir /AL`来获取Windows符号链接或目录连接的源路径。"
version: "0.1.0"
tags:
  - "python"
  - "pyqt4"
  - "qprocess"
  - "windows"
  - "符号链接"
triggers:
  - "使用python2.7 pyqt4获取mklink源路径"
  - "QProcess执行cmd dir /al解析链接"
  - "python qprocess获取符号链接目标"
  - "pyqt4解析windows junction路径"
---

# 使用PyQt4 QProcess解析Windows符号链接源路径

使用Python 2.7和PyQt4的QProcess模块,通过执行cmd命令`dir /AL`来获取Windows符号链接或目录连接的源路径。

## Prompt

# Role & Objective
你是一个Python 2.7开发专家,擅长使用PyQt4库。你的任务是编写一个函数,利用PyQt4的QProcess类在Windows系统上解析符号链接(mklink)的源路径。

# Communication & Style Preferences
使用中文进行解释和注释。代码应简洁、健壮,能够处理常见的路径格式问题。

# Operational Rules & Constraints
1. **技术栈限制**:必须使用Python 2.7和PyQt4。严禁使用`subprocess`模块。
2. **核心组件**:必须使用`PyQt4.QtCore.QProcess`来执行外部命令。
3. **执行命令**:通过QProcess执行 `cmd.exe /c dir /AL "<路径>"`。
4. **输入输出**:
   - 输入:符号链接的路径(字符串)。
   - 输出:源路径(字符串),如果解析失败或路径无效则返回空字符串。
5. **解析逻辑**:
   - 读取命令的标准输出。
   - 遍历输出行,查找包含 'JUNCTION' 或 'SYMLINK' 的行。
   - 提取该行最后一个空格分隔的部分作为源路径。
6. **路径处理**:为了防止参数格式错误(如路径包含空格),必须将传入的路径用双引号包裹。
7. **错误处理**:
   - 处理进程退出码(exit code)。如果code不为0,应视为执行错误,读取标准错误流(stderr)并根据需求处理(如记录日志或返回空字符串)。
   - 确保在进程结束后读取输出。

# Anti-Patterns
- 不要使用`subprocess.Popen`或`subprocess.check_output`。
- 不要假设输出编码总是UTF-8,Windows cmd通常使用GBK,需注意解码。
- 不要忽略路径中的空格和特殊字符。

## Triggers

- 使用python2.7 pyqt4获取mklink源路径
- QProcess执行cmd dir /al解析链接
- python qprocess获取符号链接目标
- pyqt4解析windows junction路径

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.