回复 12# yyz219
试试以下这个版本,存为 test.bat 运行...
如果用 Notepad3.exe 打开了某个文本文件(例如 a.txt),运行以下批处代码即可调用 Notepad3.exe 自动打开这个文本文件(即 a.txt)
确保在 notepad3.exe 的 ‘设置’ 菜单中取消勾选 ‘对每个文件仅允许单个实例’- 2>1/* ::
- @echo off &for /f "delims=" %%a in ('cscript /nologo /e:jscript "%~f0" ') do start "" %%a
- exit/b */
- w=GetObject('winmgmts:').instancesOf('win32_Process'), e=new Enumerator(w);
- while (!e.atEnd()) {
- i=e.item();
- if (i.name == 'Notepad3.exe') WSH.echo(i.commandline);
- e.moveNext(); }
- WSH.quit()
复制代码
|