开发者

adding .bat confirmation for user entering variables

Hi I have been editing my script with some forum help. I just need to add one last section. I need to indicate to the user running the .BAT file if the row was inserted or not? can anyone help me polish this off and I can go home a happy man !

@echo off

SET /P "NeedsList= Do you want to display a casino list? (press l for list or any other key)"

IF /I NOT [%NeedsList%] == [L] GOTO :cont
osql -STEMP7 -E -dAAMS888 -w256 -Q "SET NOCOUNT ON SELECT casino_desc from casino开发者_StackOverflow社区" -b 

:cont
set /p var1= Enter Casino Name : 
set /p var2= Enter Screen name : 

osql -STEMP7 -E -dAAMS888 -w256 -Q "DECLARE @r int EXEC @r = usp_AddToObservationtbl  '%var1%','%var2%' SELECT @r" -b -oc:\bat\observation.log
exit %errorlevel%

**need code here to indicate if they have entered a valid casino name**


I don't know about osql, but if that command can return an ERRORLEVEL code (In C language for example is the Exit code), you can trap it and make an If-statement to Echo your message.

Like This:

IF %ERRORLEVEL% == 0 (
    Echo The row was sucessfull inserted
) ELSE (
    Echo Ups, It wasn't my faul!
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜