添加 .bat 确认用户输入变量
您好,我一直在一些论坛的帮助下编辑我的脚本。我只需要添加最后一节。我需要向运行 .BAT 文件的用户指示该行是否已插入?谁能帮我解决这个问题,我就可以快乐地回家了!
@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" -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**
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" -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**
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道 osql,但如果该命令可以返回 ERRORLEVEL 代码(例如,在 C 语言中是退出代码),您可以捕获它并创建一个 If 语句来回显您的消息。
像这样:
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: