原始版對於VC6的project處理已足夠,敢對VC2007以上的本版就稍嫌不足,下面筆者有添加針對VC2010產生的暫存檔案進行刪除。
將以下程式碼存成cleanrel-install.bat進行安裝,Win8以上執行cleanrel-install.bat需要使用管理者權限安裝,Win8以下有關閉UAC者可直接點cleanrel-install.bat兩下安裝。
原始版。
@echo off rem only tested on NT 5 set instdir=%ProgramFiles%\folder-clean set regfile=%TEMP%\fclean.reg set reginstdir=%instdir:\=\\% echo Windows Registry Editor Version 5.00 >%regfile% echo [HKEY_CLASSES_ROOT\Directory\shell\For release clean\command] >>%regfile% echo @="\"%reginstdir%\\clnrmexe.bat\" \"%%1\"" >>%regfile% echo [HKEY_CLASSES_ROOT\Directory\shell\For release leave exe\command] >>%regfile% echo @="\"%reginstdir%\\cleanrel.bat\" \"%%1\"" >>%regfile% set filename1=%TEMP%\cleanrel.bat set filename2=%TEMP%\clnrmexe.bat rem vstudio files echo del /s %%1\*.aps >%filename1% echo del /s %%1\*.clw >>%filename1% echo del /s %%1\*.ncb >>%filename1% echo del /s %%1\*.opt >>%filename1% echo del /s %%1\*.plg >>%filename1% rem intermediate files echo del /s %%1\*.obj >>%filename1% echo del /s %%1\*.pch >>%filename1% echo del /s %%1\*.exp >>%filename1% echo del /s %%1\*.sbr >>%filename1% echo del /s %%1\*.bsc >>%filename1% echo del /s %%1\*.ilk >>%filename1% echo del /s %%1\*.lib >>%filename1% echo del /s %%1\*.pdb >>%filename1% echo del /s %%1\*.res >>%filename1% echo del /s %%1\*.idb >>%filename1% rem exe etc copy %filename1% %filename2% echo del /s %%1\*.exe >>%filename2% echo del /s %%1\*.dll >>%filename2% echo del /s %%1\*.hlp >>%filename2% mkdir "%instdir%" copy %filename1% "%instdir%" copy %filename2% "%instdir%" %regfile% del %filename1% del %filename2% del %regfile%
修改版。
@echo on rem only tested on NT 5 set instdir=%ProgramFiles%\Folder-Clean set regfile=%TEMP%\fclean.reg set reginstdir=%instdir:\=\\% echo Windows Registry Editor Version 5.00 >%regfile% echo [HKEY_CLASSES_ROOT\Directory\shell\For Check-In Clean\command] >>%regfile% echo @="\"%reginstdir%\\clnrmexe.bat\" \"%%1\"" >>%regfile% echo [HKEY_CLASSES_ROOT\Directory\shell\For Release Clean\command] >>%regfile% echo @="\"%reginstdir%\\cleanrel.bat\" \"%%1\"" >>%regfile% set filename1=%TEMP%\cleanrel.bat set filename2=%TEMP%\clnrmexe.bat rem vstudio files echo attrib -r -h -s %%1\*.* /s >%filename1% echo del /s %%1\*.aps >>%filename1% echo del /s %%1\*.clw >>%filename1% echo del /s %%1\*.ncb >>%filename1% echo del /s %%1\*.opt >>%filename1% echo del /s %%1\*.plg >>%filename1% rem intermediate files echo del /s %%1\*.obj >>%filename1% echo del /s %%1\*.pch >>%filename1% echo del /s %%1\*.exp >>%filename1% echo del /s %%1\*.sbr >>%filename1% echo del /s %%1\*.bsc >>%filename1% echo del /s %%1\*.ilk >>%filename1% echo del /s %%1\*.pdb >>%filename1% echo del /s %%1\*.res >>%filename1% echo del /s %%1\*.idb >>%filename1% echo del /s %%1\*.bak >>%filename1% echo del /s %%1\*.tmp >>%filename1% echo del /s %%1\Thumbs.db >>%filename1% echo del /s %%1\*.sdf >>%filename1% echo del /s %%1\*.suo >>%filename1% echo del /s %%1\*.user >>%filename1% echo del /s %%1\ReadMe.txt >>%filename1% echo rmdir /s /q %%1\Release >>%filename1% echo rmdir /s /q %%1\Debug >>%filename1% echo rmdir /s /q %%1\ipch >>%filename1% rem exe etc copy %filename1% %filename2% echo del /s %%1\*.exe >>%filename2% echo del /s %%1\*.dll >>%filename2% mkdir "%instdir%" copy %filename1% "%instdir%" copy %filename2% "%instdir%" %regfile% del %filename1% del %filename2% rem del %regfile%
參考資料