Solved

Batch programming question

Posted on 1998-07-23
8
217 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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
 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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