2014-02-25 106 views
0

試圖製作一個簡單的開關BATCH是否使用.dll。這裏是代碼:它似乎什麼都不做,但我找不到任何錯誤。幫幫我?爲什麼不用這個簡單的批處理腳本工作?

 
:StartProgram 
@echo off 

set /p UsePowerup= Would you like to use power up plug in (1=Yes;2=No;3=Exit)? 

If %UsePowerup%=3 
(
    EXIT 
) 
Else IF %UsePowerup%=2 
(
    CD C:\Program Files (x86)\Steam\SteamApps\common\Fallout New Vegas\Data\NVSE\Plugins\ 

    If EXIST geckpu-nv-14.dll 
    (
     ECHO "Moving Power Up Plugin to Desktop" 
     MOVE geckpu-nv-14.dll C:\Users\Anonymous\Desktop\ 
     ECHO "Move Power Up Plugin to Desktop SUCCESS" 
     PAUSE 
     GOTO RunGECK 
    ) 
    Else 
    (
     ECHO "Plug-in not found! Try again." 
     PAUSE 
     GOTO StartProgram 
    ) 
) 
Else IF %UsePowerup%=1 
(

    cd C:\Users\Anonymous\Desktop\ 
    If EXIST geckpu-nv-14.dll 
    (
     ECHO "Moving Power Up Plugin to GECK" 
     MOVE geckpu-nv-14.dll C:\Program Files (x86)\Steam\SteamApps\common\Fallout New Vegas\Data\NVSE\Plugins\ 
     ECHO "Move Power Up Plugin to Desktop SUCCESS" 
     PAUSE 
     GOTO RunGECK 
    ) 
    Else 
    ( 
     ECHO "Plug-in not found! Try again." 
     PAUSE 
     GOTO StartProgram 
    ) 
) 
Else ECHO "INVALID CHOICE Try Again" 
(
    PAUSE 
    CLS 
    GOTO StartProgram 
) 


:RunGECK 

cd C:\Program Files (x86)\Steam\SteamApps\common\Fallout New Vegas\ 
nvse_loader -editor 
exit

謝謝你們

+0

你是什麼意思「無所事事」?我看到的一個簡單錯誤是,選項'1'('C:\ Program Files ...')下的'MOVE'命令中的第二個參數應該有引號。 – mbroshi

+0

打開的括號''('必須和要被正確解析的語句在同一行上,命令行解析器不會向前看,因此它會停止執行,因爲它看到不完整的if語句。不正確,比較需要雙'=='標誌。 –

回答

1

你的括號內爲你的if語句必須在同一行。這同樣適用於ELSE語句。你必須使用==或EQU來進行比較。您需要將/ d添加到您的CD命令以直接轉到路徑,並且需要引用其中包含空格的路徑。您需要在函數之前的腳本末尾添加exit/b或goto:eof,否則該函數將始終運行且不帶參數。

我認爲這應該讓你更接近。

@echo off 
:StartProgram 
set /p UsePowerup=Would you like to use power up plug in (1=Yes;2=No;3=Exit)? 

If %UsePowerup%==3 (
    EXIT 
) Else (
    IF %UsePowerup%==2(
     CD /d "C:\Program Files (x86)\Steam\SteamApps\common\Fallout New Vegas\Data\NVSE\Plugins\" 

     If EXIST geckpu-nv-14.dll (
      ECHO "Moving Power Up Plugin to Desktop" 
      MOVE geckpu-nv-14.dll "C:\Users\Anonymous\Desktop\" 
      ECHO "Move Power Up Plugin to Desktop SUCCESS" 
      PAUSE 
      GOTO RunGECK 
     ) Else (
      ECHO "Plug-in not found! Try again." 
      PAUSE 
      GOTO StartProgram 
     ) 
    ) Else (
     IF %UsePowerup%==1(

      cd /d "C:\Users\Anonymous\Desktop\" 
      If EXIST geckpu-nv-14.dll (
       ECHO "Moving Power Up Plugin to GECK" 
       MOVE geckpu-nv-14.dll "C:\Program Files (x86)\Steam\SteamApps\common\Fallout New Vegas\Data\NVSE\Plugins\" 
       ECHO "Move Power Up Plugin to Desktop SUCCESS" 
       PAUSE 
       GOTO RunGECK 
      ) Else ( 
       ECHO "Plug-in not found! Try again." 
       PAUSE 
       GOTO StartProgram 
      ) 
     ) Else ( 
      ECHO "INVALID CHOICE Try Again" 
      PAUSE 
      CLS 
      GOTO StartProgram 
     ) 
    ) 
) 
exit /b 

:RunGECK 
cd /d "C:\Program Files (x86)\Steam\SteamApps\common\Fallout New Vegas\" 
nvse_loader -editor 
exit 
+0

非常感謝! – user3352738

相關問題