Solved: Using set in CMD

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

jpboyrox

Thread Starter
Joined
Nov 22, 2009
Messages
344
I am trying to get my head round the set command, why does this not work:

Code:
if %delete%==y goto y
if %delete%==n goto n

:y
cls 
rd /s/q FOLDER
cls
echo Files Deleted!
pause

:n
cls
echo Files not deleted
pause
If 'n' is selected it skips :y but if 'y' is selected it runs :y and then :n
Why is that and how can i sort it out?
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
What does this have to do with the set command? You are not even using it.

Batch is a sequential processing scripting language. If you need it to bypass the :N subroutine then you need to put in another goto after your :Y subroutine finishes.

goto :EOF (This would exit the batch file.)
 

Squashman

Retired Trusted Advisor
Joined
Apr 4, 2003
Messages
19,786
I see you marked this solved but I was hoping for a response to my question.
 

jpboyrox

Thread Starter
Joined
Nov 22, 2009
Messages
344
oh right, I actually can't remember I looked it up on youtube. I thinkot was called the 'set' command in the title. Don't know why
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top