Solved

Batch programming question

Posted on 1998-07-23
8
215 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
Comment Utility
Did you try just adding a "y" in the spot where it prompts you?
0
 

Accepted Solution

by:
Tinkerer earned 50 total points
Comment Utility
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
Comment Utility
Tinkerer...how do you may that symbol after the echo Y  ??
0
 

Author Comment

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

Thanks,

Priyo
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:Tinkerer
Comment Utility
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
Comment Utility
Hey! Hey!

Here ya go!!

This is pretty good..

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

Author Comment

by:priyo
Comment Utility
Thanks a lot pal!!

later,

Priyo
0
 

Expert Comment

by:ey143
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

The Rasberry PI is a low cost piece of hardware that you can have a lot of fun with through experimenting and building/working on projects like media players, running a low cost computer, build data loggers etc. - see: https://www.raspberrypi.org
In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

14 Experts available now in Live!

Get 1:1 Help Now