explorer 命令行
期望:windows win10,激活现有或新打开资源管理器,选中一些(一个或多个)文件。(ahk别人有实现,见扩展)
参考:
- explorer 命令参数及其应用 - 匡匡 - 博客园
源(http://support.microsoft.com/kb/307856/zh-cn)已无法打开。
“本分步指南介绍了如何在 Windows XP 中使用 Windows 资源管理器命令行参数” - Explorer.exe的命令行参数 - Sophia_tj的个人空间 - OSCHINA - 中文开源技术交流社区
Explorer [/n][/e][[,/root],[path]][[,/select],[path filename]] - 如何打开资源管理器并选中一个文件?-CSDN论坛
完整的帮助说明Windows Explorer Switches
使用Windows XP提供的SHOpenFolderAndSelectItems函数 - Explorer.exe - Windows CMD - SS64.com
完整详尽Command-line switches
貌似是XP时代的兼容保留。
选项:
- /n表示以“我的电脑”方式打开一个新的窗口
貌似与/e选项无差异。 - /e表示以“资源管理器”方式打开一个新的窗口
貌似与/n选项无差异。 - /e,path,打开指定目录
- /root,path,打开指定目录
说是root指定为根(基),仅显示指定目录,实际都显示,也看不出根的概念。 - /select,path。
貌似必须/select(不可省略为select)
可独立使用(无需先/e,path或/root,path)。
打开包含目标项(文件夹或文件)的文件夹,选中目标项。
不可多选(尝试/select,C:\1\1.txt,/select,C:\1\2.txt失败,仅选择了1.txt) - /root,path,/select,file
不可构造成path基、file偏移。
相当于/root,path,/select→/select,path。explorer /root,C:\1\,/select,.\2.txt会打开C:选中1。
(/root,path,select,file效果相当于/root,path,不会选择任何)
其他扩展:
- cmd.exe - CMD command in Windows to switch to an already open application - Super User
VBScript(.vbs),batch(.bat),JScript,cscript (console) or wscript (window),store all commands in a variable then command the variable,nircmd - c# - How to open Explorer with a specific file selected? - Stack Overflow
- SHOpenFolderAndSelectItems
- Windows – Open and Select a file in an existing Explorer window – iTecTec
CMD command in Windows to switch to an already open application
cmd.exe /c start "" "FOLDER_PATH"
taskkill /im explorer.exe /fi "windowtitle eq %title%" - SHOpenFolderAndSelectItems for explorer replacement program - AutoHotkey Community
- [Func] Open Folder With Pre-Selected Files - Scripts and Functions - AutoHotkey Community
注解比较清楚。比上面的实现精简,依赖少。
FolderPidl、PidlArray(FilesPidl),shell32\SHParseDisplayName、shell32\SHOpenFolderAndSelectItems、ole32\CoTaskMemFree - Get paths of selected items in an explorer window - Scripts and Functions - AutoHotkey Community
window="desktop"/folder,ComObjCreate("Shell.Application").Windows
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?