Computing.Net > Forums > Programming > How do I go about doing this?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How do I go about doing this?

Reply to Message Icon

Name: moonreams
Date: July 31, 2008 at 13:53:37 Pacific
OS: Xp Pro
CPU/Ram: 3ghz/4024mb
Product: custom
Comment:

Hi, I'm a newb at programming and stuff but I just want to know the best way to go about this.

Basically, I have an application. What I want to happen is run a script of some sort that launches this application (like a shortcut would). Then when the application closes I want the script to detect this, then delete some folders that have been created by the application and then close itself.

Can I do this with a batch file or do I need to go more in-depth? Any help would be appreciated. Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: July 31, 2008 at 18:23:42 Pacific
Reply:

To wait for an application to exit and then delete files from a folder:

start/wait application.exe
del C:\path\to\folder


0

Response Number 2
Name: Mechanix2Go
Date: July 31, 2008 at 18:26:44 Pacific
Reply:

myprog.exe
rd /s /q x:\thestuff


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 3
Name: klint
Date: July 31, 2008 at 23:24:06 Pacific
Reply:

Ok, with two answers, the original poster must be wondering who's right. If the application is a console application, then M2's simple "myprog.exe" is good. If it is a Windows application, the batch file will not wait for it to finish, but will start executing the next line immediately. That's why I used the "start/wait" command. M2, you're correct with the "rd/s /q" command to delete a folder: mine only deletes files within the folder, which is not what was asked.


0

Response Number 4
Name: Mechanix2Go
Date: August 1, 2008 at 00:29:19 Pacific
Reply:

Hi klint,

I dunno console app, but it waits for excel.

::===================================
"D:\Program Files\Microsoft Office\Office\EXCEL.exe"
echo hi


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 5
Name: moonreams
Date: August 1, 2008 at 03:01:42 Pacific
Reply:

Excellent, thanks very much, it worked a treat. I used klint's start/wait command and Mechanix2Go's rd command successfully. It didn't actually work to begin with but then I realised because I was deleting folders inside Documents and settings I needed to put the entire path in quotes, then it worked.

Anyway thanks very much!


0

Related Posts

See More



Response Number 6
Name: klint
Date: August 1, 2008 at 03:08:23 Pacific
Reply:

You're right again, M2. When I tested it, it didn't wait, but I was typing it directly on the command line. If you do it in a batch file, it waits.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: How do I go about doing this?

How would I go about doing this... www.computing.net/answers/programming/how-would-i-go-about-doing-this/91.html

batch right click? www.computing.net/answers/programming/batch-right-click/15657.html

C++ program www.computing.net/answers/programming/c-program/13882.html