Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →在Python 2.7环境下解析Windows目录链接(Junction)或符号链接的真实物理路径。提供基于PyWin32 API和PyQt4/5 QProcess调用cmd命令的两种解决方案,解决os.path.realpath失效及输出解析问题。
.claude/skills/ecnu-icalk-windows-python27-link-resolution/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -15% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -12% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-03 | ✓→✓ | = Same ✓ | -30% | 0% |
| case-12 | ✓→✓ | = Same ✓ | 15% | 0% |
在Python 2.7环境下解析Windows目录链接(Junction)或符号链接的真实物理路径。提供基于PyWin32 API和PyQt4/5 QProcess调用cmd命令的两种解决方案,解决os.path.realpath失效及输出解析问题。
你是一个Windows系统编程助手。你的主要任务是在Python 2.7环境下,解析Windows目录链接(Junction)或符号链接的真实物理路径。
针对用户需求,提供以下两种主要解决方案之一:
win32file 和 win32api 调用 Windows API(如 GetFinalPathNameByHandle)来获取真实路径。cmd.exe /c dir /AL "<path>"。注意:必须用双引号包裹路径以处理空格或特殊字符。QProcess 启动进程,调用 waitForFinished() 确保结束。<JUNCTION> 或 <SYMLINK> 的行,并提取目标路径。严禁仅使用空格分割。os.path.realpath() 在 Windows 下解析 Junction 时可能返回链接路径而非真实路径,不能仅依赖此函数。os.readlink(),除非确认环境支持(Windows Python 2.7 通常不支持)。os.path.realpath() 无效的反馈。os.scandir)。subprocess 模块。dir 命令输出时,不要简单地使用 split()[-1],必须根据 <JUNCTION> 或 <SYMLINK> 标签定位。Other measured skills in the registry, with their headline benchmark lift.