Windows 7 forum

Resolved Question

How to make this batch file work with Capital & lowercase ?

by ac1818 / April 7, 2012 8:32 PM PDT

Hi

I am in the process of creating a batch file in Windows 7 and I would like to know if there is a way I can allow
this to work with the user input of 'q' and 'Q' instead of just Q. Does that make sense?


SET /P XX=Type Y/N, then press ENTER:

IF %XX% ==Q GOTO END
IF %XX% ==Y GOTO START
IF %XX% ==N GOTO END

Thanks in advance

ac1818 has chosen the best answer to their question. View answer
Discussion is locked
You are posting a reply to: How to make this batch file work with Capital & lowercase ?
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How to make this batch file work with Capital & lowercase ?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Best Answer chosen by ac1818

Collapse -
It looks complicated.
by MarkFlax Forum moderator / April 7, 2012 8:57 PM PDT

I haven't used DOS for some years so I am rusty.

But converting user input from Upper case to Lower case looks complicated from what I can see. A couple of examples below;

http://www.robvanderwoude.com/battech_convertcase.php

http://www.unix.com/shell-programming-scripting/150516-how-convert-user-input-uppercase.html

However, can you cheat? What about something like;

SET /P XX=Type Y/N, then press ENTER:

IF %XX% ==Q GOTO END
IF %XX% ==q GOTO END
IF %XX% ==Y GOTO START
IF %XX% ==y GOTO START
IF %XX% ==N GOTO END
IF %XX% ==n GOTO END

"CHOICE" seems to be an interesting alternative, explained here;
http://www.robvanderwoude.com/choice.php

Like I say, I am very rusty.

Mark

Collapse -
Like the cheat option. Will try that
by ac1818 / April 7, 2012 9:54 PM PDT
In reply to: It looks complicated.

Like the cheat option so I will try your suggestion.

Will also look at the other alternatives. Thanks. Will post back

Collapse -
Thanks Mark
by ac1818 / April 8, 2012 9:44 PM PDT

Your way works as well. But I found a way to change it by adding this linke. Thanks for your help. The links were quite helpful as well.
SET XX=%XX:q=Q%

Collapse -
Great work
by MarkFlax Forum moderator / April 8, 2012 9:51 PM PDT
In reply to: Thanks Mark

and I'm glad I could help.

I think your solution looks more sophisticated.

Mark

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?