2016-08-01 64 views
-3

我不能修復這個,我希望能夠寫東西作爲與 工作的響應麻煩:是 但不 :FAP的我有批處理文件崩潰

這裏是我的代碼

:begin 
cls 
echo You wake up and realize you are never going to amount to anything, oh  well, might as well get on with your worthless life 
echo fap or vidya games 
echo. 
set /p input= 
if /i "%input%"=="Fap" goto Fap 
if /i "%input%"=="Vidya games" goto vidya games 
if /i "%input%"=="vidya" goto vidya games 
if not "%input%"=="Fap"/"vidya"/"Vidya games" goto begin 

:Fap 
cls 
echo Since you can't get a girl you decide to fantize about the girl of your dreams so you download some watamote doujins after a mixture of crying and masterbaiting you decide to change to mood 
echo vidya or sleep 
echo. 
set /p input= 
if /i "%input%"=="vidya" goto vidya fap 
if /i "%input%"=="sleep" goto sleep 
if not "%input%"=="vidya"/"sleep" goto Fap 
+0

......你的具體問題是什麼?請學習[如何問](http://stackoverflow.com/help/how-to-ask)! – aschipfl

+0

他問如何重定向到:Fap和其他標籤正確。 :) – sambul35

回答

0

批處理腳本中的標籤用冒號標記,如:begin。從IF,FOR或類似語句重定向到某個標籤時使用相同的方法。因此,通過下面這個例子編輯你的腳本:

if /i "%input%"=="Fap" (goto :Fap 
) else if /i "%input%"=="Vidya" (goto :Vidya_games 
) else (goto :begin) 
0

而是一顆顆if S的,你可以檢查,如果標籤存在,如果是,跳轉到它:

如果你有幾個問題不同的目的地,您可以相應地命名您的標籤:

@echo off 
:loop 
echo fap or vidya games 
set /p "label=Command: " 
findstr /b /i ":Q1-%label%" "%~f0" && goto :Q1-%label% 
REM previous line checks, if the label exists and if yes, jumps to it 
echo no such command: %label% & goto :loop 

:Q1-fap 
echo reached Question1 label one. 
goto :eof 

:Q1-vidya 
echo reached Question1 label two. 
goto :eof 

一些注意事項:
標籤只有一個字。第一個空格之後的所有內容都被忽略
findstr /i使其對大小寫不敏感。
/b搜索以字符串開頭的行。
&&意思是「如果先前的命令(這裏是findstr)成功,那麼」
%~f0是你的批處理文件的名稱。

,當你進入vidyaVidyaVIDYavidya GamesVidya anything這正好Q1-vidya