Batch File auto return

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.

jiggard

Thread Starter
Joined
Jun 21, 2005
Messages
26
I have a batch file and I want it to del some files without asking me to enter yes all of the time. Is there a way to get my program to automatically enter a y then enter this value.
 
Joined
Feb 11, 2002
Messages
1,405
Is there a way to get my program to automatically enter a y then enter this value.
Yes. Assuming you are using a real DOS distribution (NOT the NT/WIN2K/XP command prompt), probably the simplest way is to use the deltree command with the /y option ("assume 'yes' to delete requests"). So, for example, instead of using:
del filename.ext
you would use:
deltree /y filename.ext

You can also create a file with a single 'Y' character in it, and redirect input to the del command from the file. For example, if the file that contains a single 'Y' character is named yes.txt, you could use:
del filename.ext < yes.txt
This should work on all DOS versions as well as the command prompts in NT/WIN2K/XP.

Hope this helps.
 
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

Top