y/n option to call another .cmd

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

y/n option to call another .cmd

#1 Post by wchristner » 05 Nov 2015 10:01

I have a usb frive with an Install.cmd and a format.cmd
I want to create a batch file to run a cmd on the same flash drive depending on what key is pressed.
below is what I have so far.

set /p f=Type y/n for option:

IF "%f%=="y" Call Install.cmd
IF "%f%=="n" Call format.cmd

am I missing somthing such as an else command?
when ran I get an invalid syntax error when y or n is entered.

Thnaks for the help

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: y/n option to call another .cmd

#2 Post by Squashman » 05 Nov 2015 10:18

You are missing quotes that surround %f%

wchristner
Posts: 24
Joined: 06 May 2014 09:55
Location: North West Indiana

Re: y/n option to call another .cmd

#3 Post by wchristner » 05 Nov 2015 10:25

Thanks...I can't believe I missed that.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: y/n option to call another .cmd

#4 Post by Squashman » 05 Nov 2015 10:28

wchristner wrote:Thanks...I can't believe I missed that.


Oh trust me. I have done worse.

Code: Select all

%somvar&


Could not figure it out until someone pointed it out too me.

Post Reply