2011-10-01 53 views
1

Oo所以我創建了一個批處理文件。它在Windows 7中工作正常,但是當我在Vista中測試它仍然可以工作,但它會跳過:DELETE標籤,它將直接進入:開始請幫助標籤 ? ,謝謝你的時間。你如何讓這個批處理文件在Vista中工作?

:: Batch file Created By Ookami 
:: 
:: Copyright (c) 2011 NearFang™ 
:: 
:: Facebook: http://www.facebook.com/00k4MI 
:: 
:MAIN 
@ECHO OFF 
mode con:cols=43 lines=10 
color 5B 
title MCTool 

echo %~n0%~x0 started from Directory: %~d0%~p0 > nul 
%~d0 
cd %~d0%~p0 

:Menu 
echo MC Batch Tool Copyright (c) 2011 Ookami. 
echo ----------------------------------------- 
echo [OPTIONS]: 
echo ========================================= 
echo [1]Run minecraft installer 
echo [2]Restore .minecraft 
echo ========================================= 
set /p choice=Enter Option: 
if %choice% == 1 goto 1 
if %choice% == 2 goto 2 
GOTO Menu 

:1 
IF NOT EXIST .minecraft GOTO ERROR2 
IF NOT EXIST %APPDATA%\.minecraft GOTO BEGIN 
IF EXIST %APPDATA%\.minecraft GOTO DELETE 
IF EXIST .minecraft GOTO BEGIN 

:BEGIN 
XCopy ".minecraft" "%appdata%\.minecraft" /S /E /I /Y 
cls 
echo Pre-Modded minecraft installed... 
echo. 
pause 
EXIT 

:DELETE 
cls 
echo An existing .minecraft folder was found! 
echo. 
echo Create backup, before deletion? 
SET /P input=Yes or No (Y/N): 
IF '%input%' == 'Y' (
GOTO BACKUP 
) 
IF '%input%' == 'y' ( 
GOTO BACKUP 
) 
IF '%input%' == 'N' ( 
GOTO DELNOW 
) 
IF '%input%' == 'n' ( 
GOTO DELNOW 
) ELSE (
GOTO ERROR 
) 

:BACKUP 
IF EXIST mcbak\.minecraft RD mcbak\.minecraft /S /Q 
XCopy "%appdata%\.minecraft" "mcbak\.minecraft" /S /E /I /Y /Q 
cls 
echo Copied Folder To: 
echo. 
echo %~d0%~p0 
echo. 
echo successfully completed! 
echo. 
pause 
cls 
echo starting deletion process... 
RD /S /Q "%APPDATA%\.minecraft" 
echo. 
echo .minecraft folder has been Deleted 
echo. 
pause 
cls 
echo Now installing Pre-Modded minecraft folder 
XCopy ".minecraft" "%appdata%\.minecraft" /S /E /I /Y /Q 
echo. 
echo successfully completed... 
echo. 
pause 
EXIT 

:DELNOW 
cls 
echo Starting Deletion Process... 
RD /S /Q "%APPDATA%\.minecraft" 
echo. 
echo .minecraft folder has been Deleted 
echo. 
pause 
cls 
echo Now installing Pre-Modded minecraft folder 
XCopy ".minecraft" "%appdata%\.minecraft" /S /E /I /Y /Q 
echo. 
echo successfully completed... 
echo. 
pause 
EXIT 

:ERROR 
echo. 
echo Your input was invalid 
echo. 
PAUSE 
GOTO DELETE 

:ERROR2 
cls 
echo .minecraft folder was not found! 
echo. 
echo Note: mctool must be next to .minecraft 
echo. 
PAUSE 
EXIT 

:2 
IF NOT EXIST mcbak\.minecraft GOTO noget 
IF NOT EXIST %APPDATA%\.minecraft GOTO nowget 
IF EXIST %APPDATA%\.minecraft GOTO DELNOW 
IF EXIST mcbak\.minecraft GOTO nowget 

:nowget 
XCopy "mcbak\.minecraft" "%appdata%\.minecraft" /S /E /I /Y 
cls 
echo Minecraft has been Restored successfully 
echo. 
pause 
exit 

:DELNOW 
cls 
RD /S /Q "%APPDATA%\.minecraft" 
GOTO nowget 

:noget 
cls 
echo No backups found or have been created 
echo. 
echo Note: mctool must be next to mcbak folder 
echo. 
pause 
exit 

回答

3

儘量把%appdata引號內,就像這樣:IF EXIST "%APPDATA%"\.minecraft GOTO DELETE

+1

TY !!!起初它並沒有幫助我最終不得不添加「到每一個IF聲明,但我只想到它導致你爲它帶來了一個強大的cookie xD! – OoKami

相關問題