Solved

Batch programming question

Posted on 1998-07-23
8
216 Views
Last Modified: 2010-04-26
Hi,

I'm trying to teach myself simple batch programming and had a few questions:

1) I was writing a simple batch file to create a self-extracting archive and here's the script:

cd zip
pkzip zipped.zip *.*
zip2exe zipped.zip
move zipped.exe c:\_aaZIPPED\
erase *.*
cd ..
exit

The problem I'm having is making it two do things:
a) it reacts to the "erase *.*" by asking me a question. How do I get it to proceed with "yes to all"?

b) how do I make it exit the MSDos program after executing the batch program?

2)  Is there any good source to learn the simpler elements of batch programming?

thanks,

Priyo
0
Comment
Question by:priyo
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 2

Expert Comment

by:SirCaleb
ID: 1019957
Did you try just adding a "y" in the spot where it prompts you?
0
 

Accepted Solution

by:
Tinkerer earned 50 total points
ID: 1019958
change " rase *.*" to "echo Y | erase *.*"
That will echo a Y to answer the question "all files in this directory will be deleted! are you sure?"

if youy are running it through win95, you have to set it to exit on finish in the program properties.. right click on the batch file, click on properties, click on the program tab, and click close on exit...
0
 
LVL 2

Expert Comment

by:SirCaleb
ID: 1019959
Tinkerer...how do you may that symbol after the echo Y  ??
0
 

Author Comment

by:priyo
ID: 1019960
thanks much -- it worked; any suggestions on a good source to pick up the finer points of batch programming?

Thanks,

Priyo
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 

Expert Comment

by:Tinkerer
ID: 1019961
Example..

   cd zip
   pkzip zipped.zip *.*
   zip2exe zipped.zip
   move zipped.exe c:\_aaZIPPED\
   echo Y | erase *.*
   cd ..
   exit

The Pipe symbol is usually above the \ symbol
(shift + backslash)

Honestly, I don't know any good resources on the web, I would recommend a half price book store, older books, ya know..
http://users.demag.rwth-aachen.de/Donald/nt/faq/ntfaq/batch.html

0
 

Expert Comment

by:Tinkerer
ID: 1019962
Hey! Hey!

Here ya go!!

This is pretty good..

http://www.slip.net/~batchman/support.html
0
 

Author Comment

by:priyo
ID: 1019963
Thanks a lot pal!!

later,

Priyo
0
 

Expert Comment

by:ey143
ID: 1019964
Try this book

Microsoft Quick Reference - MS Dos Batch Files

by Kris Jamsa

it's old, around early 90s, but I found an unused copy in my bookshelf, pretty useful stuff, far more complex for me to understand though!

Dan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now