我也尝试在我的批处理脚本中获取Ping脚本,但现在它不再起作用了。
@echo off
title Windows Fix Script BETA - Running as Admin check
if "%2"=="firstrun" exit
cmd /c "%0" null firstrun
if "%1"=="skipuac" goto skipuacstart
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (shift & goto gotPrivileges)
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
:gotPrivileges
setlocal & pushd .
cd /d %~dp0
cmd /c "%0" skipuac firstrun
cd /d %~dp0
:skipuacstart
if "%2"=="firstrun" exit
@echo off
title Windows Fix Script 1.1 BETA
goto menu
:menu
cls
echo Please choose an option from the menu.
echo Unsure what the script does? Press H for more information.
echo Choose OPTION J if you don't want to use this script!
echo NOTE: You need to confirm before the script will delete anything!
echo 1. Empty Downloads
echo 2. Empty Temp
echo 3. Empty Recycle Bin
echo 4. IP configuration release
echo 5. IP configuration renew
echo 6. IP configuration complete
echo 7. Information
echo 8. Copyright
echo 9. Exit
:: Note - list ERRORLEVELS in decreasing order
CHOICE /C 123456789 /M "Enter your choice:"
if ERRORLEVEL 1 goto downloads
if ERRORLEVEL 2 goto temp
if ERRORLEVEL 3 goto recycle
if ERRORLEVEL 4 goto ipconfig_release
if ERRORLEVEL 5 goto ipconfig_renew
if ERRORLEVEL 6 goto ipcomplet
if ERRORLEVEL 7 goto information
if ERRORLEVEL 8 goto copyright
if ERRORLEVEL 9 goto exit
:ipconfig_complete
cls
echo This option will release and renew your IP configuration directly.
CHOICE /C YN /M "Enter your choice: "
IF ERRORLEVEL 2 GOTO menu
IF ERRORLEVEL 1 GOTO ipcomplet
:menu
goto menu
:ipcomplet
ipconfig /release
cls
echo We released your IP configuration.
timeout 5 /nobreak
ipconfig /renew
cls
echo We renewed your IP configuration.
timeout 5 /nobreak
goto menu
:ipconfig_release
cls
echo This option will release the IP configuration. Please use the renew option after you runned this script.
CHOICE /C YN /M "Enter your choice: "
IF ERRORLEVEL 2 GOTO menu
IF ERRORLEVEL 1 GOTO iprelease
:menu
goto menu
cls
:iprelease
cls
ipconfig /release
cls
echo The IP configuration has been released, press any key for the menu.
pause >null
goto menu
:ipconfig_renew
cls
echo This option will renew the IP configuration.
CHOICE /C YN /M "Enter your choice: "
IF ERRORLEVEL 2 GOTO menu
IF ERRORLEVEL 1 GOTO iprenew
:menu
goto menu
cls
:iprenew
cls
ipconfig /renew
cls
echo The IP configuration has been renewed, press any key for the menu.
pause >null
goto menu
:information
cls
echo This Batch script is written to help you deleting spefic documents from your system.
echo On this moment it works for the Temponary files, the Downloads folder and your Recycle Bin.
echo It also can fix your netwerk connection and check for internet.
echo Prss any key for the menu.
pause >null
goto menu
:copyright
cls
echo This script is written by Mark de Jager to empty different locations on your system. You can use this at own risk but always can ask for support.
echo Twitter: @Vlumondoxa
echo Skype: markdejager.hwi
echo Press any key for the menu.
pause >nul
goto menu
:exit
cls
echo Thank you for using this script, it will close itself after 10 seconds.
timeout 10 /nobreak
exit
:temp
CHOICE /C YN /M "Enter your choice: "
IF ERRORLEVEL 2 GOTO reset
IF ERRORLEVEL 1 GOTO deltemp
:reset
goto menu
cls
:deltemp
cls
FOR /D %%p IN ("C:\Windows\Temp\*.*") DO rmdir "%%p" /s /q
cd C:\Windows\Temp
del *.* /q /s
timeout 5
cls
echo We deleted everything in the Temp folder.
echo Note: Please delete the files which aren't deleted yourself.
echo Press any key for the menu.
pause >null
cls
goto menu
:downloads
CHOICE /C YN /M "Enter your choice:"
IF ERRORLEVEL 2 goto reset
IF ERRORLEVEL 1 GOTO deldownloads
:reset
goto menu
cls
:deldownloads
cls
FOR /D %%p IN ("C:\USERS\%USERNAME%\Downloads\*.*") DO rmdir "%%p" /s /q
cd C:\USERS\%USERNAME%\Downloads\
del *.* /q /s
timeout 5
cls
echo We deleted everything in the Downloads folder.
echo Press any key for the menu.
pause >null
cls
goto menu
:recycle
CHOICE /C YN /M "Enter your choice: "
IF ERRORLEVEL 2 GOTO reset
IF ERRORLEVEL 1 GOTO delrecycle
:reset
goto menu
cls
:delrecycle
cls
rd /s /q %systemdrive%\$Recycle.bin
echo We emptied your recycle bin.
echo Press any key for the menu.
pause >null
cls
goto menu
每个选项现在都是第一个选项,删除下载。我怎样才能解决这个问题并让它再次稳定?
另外,我如何添加Ping脚本给谷歌ping,然后暂停> null以返回菜单?
提前致谢。
答案 0 :(得分:1)
if ERRORLEVEL 1 goto downloads
if ERRORLEVEL 2 goto temp
if ERRORLEVEL 3 goto recycle
if ERRORLEVEL 4 goto ipconfig_release
if ERRORLEVEL 5 goto ipconfig_renew
if ERRORLEVEL 6 goto ipcomplet
if ERRORLEVEL 7 goto information
if ERRORLEVEL 8 goto copyright
if ERRORLEVEL 9 goto exit
错误级别需要按降序排序。这是因为当errorlevel为9时,错误级别8,7,6,5,4,3,2和1也为真。你必须先检查最高。