2017-06-09 4 views
0

はい、このタスクには管理者権限が必要ですが、私の問題には影響しないので、私はそれを含めませんでした。私はy/nとタイプします。常に同じ結果になります。どうして?

私の問題は、次のとおりです。 私は "Y"、 "N"、 "Y" または "N" と入力天気を、私はいつも

:yes 
    cls 
    set /p usrnm=Enter Username: 

に取得し、私は理由を知りません。誰かが解決策を持っていますか?

あなたは

:start 
echo This sets your default Microphone Volume to 70% and runs automatically in background after starting your Computer. 

set /p anwsr=Do you wish to continue? (y/n): 
If %anwsr%=="y" goto yes 
If %anwsr%=="n" goto no 
If %anwsr%=="Y" goto yes 
If %anwsr%=="N" goto no 
If %anwsr%=="" goto start && cls 

:yes 
cls 
set /p usrnm=Enter Username: 
If %usrnm%=="" goto yes && cls && echo Username must not be empty! 
copy "stop_auto_audio_leveling.bat" "C:\Windows" 
copy "invisble.vbs" "C:\Users\%usrnm%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" 
copy nircmd.exe "C:\Windows" 
copy nircmdc.exe "C:\Windows" 
goto no 

:no 
cls 
echo Program will now quit. Thank you for using my installer! 
pause 
exit 
+0

:yes'それだけで。 – Ryan

答えて

1

If %anwsr%=="N"で、anwsrの内容はN、ない"N"である可能性が高いのでお願いします。

ifコマンドのどれもブランチを引き起こさない場合は、バッチが単に行単位でコマンドを実行するため、実行は:yesに続きます。

ソリューション:

使用If /i "%anwsr%"=="N"

どこ/i手段 ` "大文字と小文字を区別しない"` If`sのいずれが入力されていない場合、実行は以降継続し、 `ヒット

+1

また、 ':yes'ラベルの前に無条件の' goto:start'のようなものを追加してください(おそらく "_I do not understand that_"メッセージの後に)、あなたは誤って "yes"ブランチに入ることはありません。 – TripeHound

関連する問題