⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deletespecialfile.bat

📁 快速删除VC
💻 BAT
字号:
@echo off

if not [%OS%] == [Windows_NT] (
    cls
    call :ShowAuthor
    echo.
    echo This batch file only can run on WinNT
    echo.
    pause
    goto :EOF
)

if [%1] == [] goto SetEnvironment
if [%2] == [] goto EnvironmentError
if not exist %2 goto EnvironmentError

title=Deleting specified files please wait...

::Delete all specified files

echo.
echo.
echo Preparing to delete special files. Please wait......
echo.
echo.

for /F "eol=;tokens=*" %%i in (%~dpf2) do (
    call :DeleteFiles %%i %1
)

::Delete completed
echo.
echo.
call :ShowAuthor
echo.
title=Delete complete
echo Delete complete.
echo.

pause
goto :EOF

::*****************************************************************************
:SetEnvironment

echo No parameters passed in setting environment.
title=Set environment

::replace all backslash to double backslash
set OldPath=%~dp0
set NewPath=
set OneChar=

:loop
if [%OldPath%]==[] goto done
set OneChar=%OldPath:~0,1%
if [%OneChar%] == [\] (
    set NewPath=%NewPath%%OneChar%\
) else (
    set NewPath=%NewPath%%OneChar%
)
set OldPath=%OldPath:~1%
goto loop    
:done

::Write registry key and value

set RegDll=%TEMP%\AddFolderMenu.dll

set DeleteKeyName=DeleteSpecifiedlFiles
set DeleteKeyValue="Delete specified files"

set DeleteSetupKeyName=DeleteSpecifiedlFilesSetup
set DeleteSetupKeyValue="Delete specified files extention setup"


::Clear all content to write new
 >%RegDll% echo Windows Registry Editor Version 5.00
>>%RegDll% echo.

call :AddRegistryKey HKEY_CLASSES_ROOT\Directory
call :AddRegistryKey HKEY_CLASSES_ROOT\Drive

::Add to registry
regedit /s %RegDll%

::Delete the temp dll file
del %RegDll%

call :CheckFileExtList

call :ShowAuthor
title=Set enviroment completed.
echo.
echo Environment has been set.
echo.
echo.

pause
goto :EOF

::*****************************************************************************
::Add registry key to system

:AddRegistryKey

>>%RegDll% echo [%~1\shell\%DeleteKeyName%]
>>%RegDll% echo @=%DeleteKeyValue%
>>%RegDll% echo [%~1\shell\%DeleteKeyName%\command]
>>%RegDll% echo @="\"%NewPath%%~nx0\" \"%%1\" \"%NewPath%FileExtList.txt\""
>>%RegDll% echo.

>>%RegDll% echo [%~1\shell\%DeleteSetupKeyName%]
>>%RegDll% echo @=%DeleteSetupKeyValue%
>>%RegDll% echo [%~1\shell\%DeleteSetupKeyName%\command]
>>%RegDll% echo @="notepad \"%NewPath%FileExtList.txt\""
>>%RegDll% echo.
  
goto :EOF

::*****************************************************************************
::Check extention list file create if not exist.

:CheckFileExtList

Set FileExtList="%~dp0FileExtList.txt"

if not exist %FileExtList% (
    ::Create extention filter file
     >%FileExtList% echo ;VC++ files
    >>%FileExtList% echo *.obj
    >>%FileExtList% echo *.pch
    >>%FileExtList% echo *.pdb
    >>%FileExtList% echo *.ilk
    >>%FileExtList% echo *.exp
    >>%FileExtList% echo *.trg
    >>%FileExtList% echo *.idb
    >>%FileExtList% echo *.tmp
    >>%FileExtList% echo *.plg
    >>%FileExtList% echo *.ncb
    >>%FileExtList% echo *.aps
    >>%FileExtList% echo *.bsc
    >>%FileExtList% echo *.sbr
    >>%FileExtList% echo.
    >>%FileExtList% echo ;Delphi files
    >>%FileExtList% echo *.~*   
)

goto :EOF
  
::*****************************************************************************
::Delete specified files

:DeleteFiles

set Ext=%1

::All characters were blanks not allowed
if [%Ext%] == [] goto :EOF

::All characters were asterisks not allowed
set Char=
set ExtCharators=%Ext:~2%

:checkloop
if [%ExtCharators%] == [] goto :EOF
set Char=%ExtCharators:~0,1%
if not [%Char%] == [*] goto done
set ExtCharators=%ExtCharators:~1%
goto checkloop

:done

if [%~n2] == [] (
    ::Is a drive
    del "%~2%1" /S/F/Q
) else (
    ::Is a folder
    del "%~2\%1" /S/F/Q
)

goto :EOF

::*****************************************************************************
::Environment set not correct

:EnvironmentError

call :ShowAuthor
echo Environment registried error or %2 not exist.
echo Please reregistered it and make sure %2 is exist.
echo.
echo.

pause
goto :EOF   

::*****************************************************************************
:ShowAuthor

echo.
echo --------------------------------------------------------------------------
echo *                        Author: Hongjun Ge                              *
echo *                        EMail : sdhongjun@163.com                       *
echo *                        Date  : 2005-10-31                              *
echo --------------------------------------------------------------------------
echo.
echo.

goto :EOF

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -