一键清除VC工程生成的垃圾文件

  • 下载代码,并把它保存为.bat文件,然后运行这个批处理文件。
  • 安装完成后,当点击一个目录时,右键菜单中会出现“清除VC工程”的菜单,这样就可以清除相应目录下的VC工程垃圾文件。

 

@echo   off
cls
@
rem  BC微软自win2000以后都取消了批处理中常用的choice命令,为了兼容2k/xp/2k3不得不采用脚步进行用户确认交互
echo  WScript . Quit ( WScript . CreateObject ( ^ " WScript.Shell^ " ). Popup ( WScript . Arguments ( 0 ), 0 , WScript . Arguments ( 1 ), 4 + 32 ));> " %TEMP%ChoiceSubst.js "

if  { %1 } == {}  goto  help
if  { %1 } == {install}  goto  install

WScript 
" %TEMP%ChoiceSubst.js "   " 确认清除该目录下(包括子目录)的VC工程垃圾文件吗? "   " %1 "
if  % ERRORLEVEL % == 6   GOTO  cleanfile
goto   end

:cleanfile
del   / / " %1*.hpj "   " %1*.aps "   " %1*.ncb "   " %1*.opt "   " %1*.pdb "   " %1*.pch "   " %1*.mdp "   " %1*.plg "   " %1*.obj "   " %1*.exp "   " %1*.bsc "   " %1*.clw "   " %1*.res "   " %1*.sbr "   " %1*.ilk "   " %1*.idb "
goto   end


:install
echo  开始安装
copy   / " %0 "  %SystemRoot% system32 CleanVcPrj . bat
echo  Windows Registry Editor Version  5.00 > %temp% CleanVcPrj . bat . reg
echo  [HKEY_CLASSES_ROOT Directory shell CleanVcProject] >> %temp% CleanVcPrj . bat . reg
echo  [HKEY_CLASSES_ROOT Directory shell CleanVcProject] >> %temp% CleanVcPrj . bat . reg
echo  ^@ = ^ " 清理VC工程文件^ " >> %temp% CleanVcPrj . bat . reg
echo  [HKEY_CLASSES_ROOT Directory shell CleanVcProject command ] >> %temp% CleanVcPrj . bat . reg
echo  [HKEY_CLASSES_ROOT Directory shell CleanVcProject command ] >> %temp% CleanVcPrj . bat . reg
echo  ^@ = ^ " CleanVcPrj.bat ^ " % %1 ^ " ^ " >> %temp% CleanVcPrj . bat . reg
regedit
. exe  / s %temp% CleanVcPrj . bat . reg
del   / q %temp% CleanVcPrj . bat . reg
echo  安装完成,祝您工作顺利!
pause
goto   end


:help
echo  ┌──────────────────────────┐
echo  │说明:                                              │
echo  │VC工程清理工具 v1 . 0      2006 / 1 / 16                     │
echo  │这个工具可以清理VC工程中的垃圾文件,带自安装功能。  │
echo  │绿色软件,只有3k大小 , 开放源码,随意修改。           │
echo  │有问题或者有更好的方法实现或增强,请别忘了告诉我哦。│
echo  │我的邮箱:modasi@ 163 . com QQ号 / MSN: 730037 @qq . com    │
echo  ├──────────────────────────┤
echo  │安装方法:                                           │
echo  │在cmd控制台窗口中带 install 参数运行即可。          │
echo  │例如 C: ^ > cleanvcprj . bat install                     │
echo  ├──────────────────────────┤
echo  │使用方法:                                          │
echo  │在要清理的文件夹上点击右键,选择[清理VC工程文件]。  │
echo  │使用命令行调用也可以实现批量清理等功能,例如:       │
echo  │C: ^ > cleanvcprj . bat ^ " 要清除的目录^ "                    │
echo  └──────────────────────────┘

WScript 
" %TEMP%ChoiceSubst.js "   " 您现在要进行安装吗? "   " 安装VC工程清理工具 "
if  % ERRORLEVEL % == 6   GOTO  install
goto   end

:end

你可能感兴趣的:(c,工作,cmd,System,工具,微软)