添加 .bat 确认用户输入变量

发布于 2024-11-20 00:26:18 字数 660 浏览 5 评论 0原文

您好,我一直在一些论坛的帮助下编辑我的脚本。我只需要添加最后一节。我需要向运行 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

べ映画 2024-11-27 00:26:18

我不知道 osql,但如果该命令可以返回 ERRORLEVEL 代码(例如,在 C 语言中是退出代码),您可以捕获它并创建一个 If 语句来回显您的消息。

像这样:

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

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!
)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文