Web Hosting, Design, & Coding forum

General discussion

Help writing bat file

by Jill_H / February 18, 2008 11:04 AM PST

I am newbie to batch files. Any help would be appreciated.
I want to execute a dtsx package first and when complete execute an ant file.

First, I want to check if any files (.txt) exists in a folder.
IF exists *.txt in D:\folder
if yes:
(C:\SQL\ProjectName\bin - do I haveto set the path first?)
execute dtexec /f mypackage.dtsx
then:
(D:\MyTools\bin)
execute ant -buildfile D:\project\conf\file.xml

If no files exists and folder is empty : quit


Hope this makes sense,
Jill

Discussion is locked
You are posting a reply to: Help writing bat file
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Help writing bat file
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
vauge suggestions....
by Jill_H / February 19, 2008 4:53 AM PST

Thanks for the warm welcome Kees!
Thanks for the suggestion to actually perform a search on Google, mind blowing! I have already searched around and have not been able to find a particular good tutorial.
Hence the post.
If you have a particular tutorial that you have used and would like to recommend that would be cool.

Collapse -
Re: tutorial
by Kees Bakker / February 19, 2008 9:11 PM PST
In reply to: vauge suggestions....

I learned it from the DOS 5.0 manual.

What's your exact problem? I mean, what particular command don't you grasp? And what part works?
I see the following elements:
- if to see if files exist
- cd to jump to the right folder
- running a program

Tell more on where you get stuck.

Kees

Collapse -
This is what I got..
by Jill_H / February 22, 2008 8:32 AM PST
In reply to: Re: tutorial

This is what I got so far and this works.
Is there anyway I can verify that the second process does not starts until the first has completed?

@echo
If exist C:\testFolder\testfile.txt (
echo file exists
cd "C:\Documents\JillH\Desktop\EmbeddedSQL\DB_Project_INT\bin"
dtexec /f loadRArecords.dtsx
REM(The next process should not start until the first one has completed)
cd "C:\Client\Tools\bin"
ant -buildfile C:\Client\Tools\config\demo_1.xml
) else (
echo file does not exists
EXIT
)

Thanks,

Collapse -
Re: batchfile
by Kees Bakker / February 22, 2008 11:57 PM PST
In reply to: This is what I got..

Try start with the /wait switch for the first program. Help start in the command window will give some info. Like
start /wait dtexec ...

Hope this helps.


Kees

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

GIVEAWAY

Turn up the volume with our Apple Byte sweeps!

Two lucky winners will take home the coveted smart speaker that lets Siri help you around your connected house. This sweepstake ends Feb. 25, 2018.