写了一个用NOTEPAD2打开的批处理:- PUSHD %~dp0
- copy NOTEPAD.EXE "%ProgramFiles%"
- cd /d %ProgramFiles%
- reg add "HKLM\SOFTWARE\Classes\*\shell\用Notepad2打开\command" /f /ve /t REG_SZ /d "%cd%\NOTEPAD.EXE %%1"
- @echo off
- for /f "tokens=2 delims=[" %%a in ('ver') do for /f "tokens=2,3 delims=. " %%b in ("%%a") do set Winver=%%b%%c
- @echo on
- IF %winver% GEQ 60 if not "%windir:~,2%"=="X:" set UserPrograms=%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
- IF %winver% LSS 60 if not "%windir:~,2%"=="X:" set UserPrograms=%USERPROFILE%\「开始」菜单\程序
- if not "%windir:~,2%"=="X:" mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):Set b=a.CreateShortcut(""%UserPrograms%\NOTEPAD.lnk""):b.TargetPath=""%cd%\NOTEPAD.EXE"":b.WorkingDirectory=""%cd%\"":b.Save:close")
- IF %winver% GEQ 60 if not "%windir:~,2%"=="X:" call :StartMenuPin
-
- ::IF %winver% GEQ 60 set UserMenu=%USERPROFILE%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu
- IF %winver% GEQ 60 set UserMenu=%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu
- IF %winver% LSS 60 set UserMenu=%USERPROFILE%\「开始」菜单
- ::if "%windir:~,2%"=="X:" PECMD.EXE LINK %%Programs%%\NOTEPAD,%cd%\NOTEPAD.EXE
- if "%windir:~,2%"=="X:" PECMD.EXE LINK %UserMenu%\NOTEPAD,%cd%\NOTEPAD.EXE
- ::start /b "" "%cd%\NOTEPAD.EXE"
- goto :eof
-
- :StartMenuPin
- echo Sub startpin(lnkfile)>>Win7.vbs
- echo 'Const CSIDL_COMMON_PROGRAMS = ^&H17>>Win7.vbs
- echo Set objShell = CreateObject("Shell.Application")>>Win7.vbs
- echo 'Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)>>Win7.vbs
- echo 'strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path>>Win7.vbs
- echo path=Left(lnkfile,InStrRev(lnkfile,"\"))>>Win7.vbs
- echo Set objFolder = objShell.Namespace(path)>>Win7.vbs
- echo name=Replace(lnkfile,path,"")>>Win7.vbs
- echo Set objFolderItem = objFolder.ParseName(name)>>Win7.vbs
- echo Set colVerbs = objFolderItem.Verbs>>Win7.vbs
- echo For Each objVerb in colVerbs>>Win7.vbs
- echo If Left(objVerb.name,2) = "附到" Then objVerb.DoIt>>Win7.vbs
- echo Next>>Win7.vbs
- echo End Sub>>Win7.vbs
- echo startpin Wscript.Arguments(0)>>Win7.vbs
- ping 127.0.0.1 -n 3 >nul 2>nul
- Win7.vbs "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\NOTEPAD.lnk"
- ping 127.0.0.1 -n 5 >nul 2>nul
- del /q Win7.vbs
- goto :eof
-
- Windows Registry Editor Version 5.00
-
- ;;用记事本打开
- ;[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\用记事本打开\command]
- ;@="notepad.exe %1"
- ;;用Notepad2打开
-
- ;;用Notepad2打开
- [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\用Notepad2打开\command]
- @="D:\\Green Soft\\NOTEPAD.EXE %1"
复制代码
|