Priya Jakkinpali

Greenhorn
+ Follow
since Mar 17, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Priya Jakkinpali

Never mind. I got this figured out.
I changed my code to:

Process p = r.exec("cmd /c start C:/BatchJobs/test.bat");

This works just fine.

Thanks
18 years ago
Hi Paul Clapham,
I tried your method. Still does not work. Same problem.
-Priya
18 years ago
Hi All,
I am trying to run a bat file from my java app using the following command:

Runtime r = Runtime.getRuntime();
r.exec("C:\\BatchJobs\\test.bat");

My test.bat file contains the following:

cd C:\BatchBobs
cp test1.txt test2.txt


However, when i run my app, the test2.txt file is not created. When i run the test.bat file from command line, it works perfectly fine.

Also, another thing, if I try to run an exe file using the same java code as above, it works.
e.g: i thried this:

r.exec("C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE");

When i ran my java program, it successfully opened Microsoft Excel.

Why cant I run my bat file?
Please HELP!!!
18 years ago