中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-09 04:15
47,811 topics / 349,895 posts / today 0 new / 48,253 members
DOS批处理 & 脚本技术(批处理室) » What's wrong?
Printable Version  1,194 / 9
Floor1 radem Posted 2008-06-24 12:46
高级用户 Posts 383 Credits 691
I set up a CS server just for fun. Since mine is a dynamic IP, and adding SXE requires modifying the IP parameter, I made a P to do it:


What I wanted was to import only when "Y" is entered, but right now only pressing Enter directly exits; pressing any key will import it. So where exactly is the mistake?
Floor2 hongewuyan Posted 2008-06-24 12:48
初级用户 Posts 29 Credits 65
if /i “%cf%”=="y" goto :cip || goto :eof


Try adding quotes around %cf% in this line, and I also suggest adding /I so it won't be case-sensitive...
Floor3 radem Posted 2008-06-24 12:53
高级用户 Posts 383 Credits 691
Thanks! Still doesn't work
Floor4 kgdetg1127 Posted 2008-06-24 13:18
初级用户 Posts 89 Credits 158
Floor5 kgdetg1127 Posted 2008-06-24 13:22
初级用户 Posts 89 Credits 158
Floor6 radem Posted 2008-06-24 13:53
高级用户 Posts 383 Credits 691
Originally posted by kgdetg1127 at 2008-6-24 01:22 PM:
if not %cf%==y goto :eof ||goto :cip


It can't jump to cip
Import failed
Floor7 hongewuyan Posted 2008-06-24 15:05
初级用户 Posts 29 Credits 65
I think
if /i “%cf%”=="y" goto :cip || goto :eof

this way of writing is itself problematic. Whether the input is correct or not, the goto :eof after || will never get executed.
I suggest changing those lines like this:

if /i "%cf%"=="y" goto :cip
goto :eof
:cip

This way, when the input is Y it jumps to clip, otherwise it executes the next line and automatically jumps to eof
Floor8 bat-zw Posted 2008-06-24 15:10
金牌会员 Posts 1,276 Credits 3,105
if /i "%cf%" neq "y" goto :eof
echo.
echo Importing, please wait...
Floor9 wxcute Posted 2008-06-24 21:48
中级用户 Posts 211 Credits 458
if %cf%=="y" goto :cip || goto :eof
:cip

Change it to:
if %cf%=="y" goto :cip else goto :eof
:cip

or
if not "%cf%"=="y" goto :eof
Floor10 radem Posted 2008-06-25 18:46
高级用户 Posts 383 Credits 691
<!Originally posted by zw19750516 at 2008-6-24 03:10 PM:
if /i "%cf%" neq "y" goto :eof
echo.
echo Importing, please wait...

That's it! Thanks ]>
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023