?
Solved

command prompt batch file

Posted on 2013-06-06
6
Medium Priority
?
770 Views
Last Modified: 2013-06-07
How can I run multiple commands from a batch file

This works
@echo off
cmd.exe /K "cd C:\Program Files (x86)\Java\jre7\bin"


The last line in this does not.
I tried adding double quotes etc...
Any ideas?

@echo off
cmd.exe /K "cd C:\Program Files (x86)\Java\jre7\bin"
cmd.exe java -cp m5.jar;m5-data-objects.jar;webservices-rt.jar;log4j-1.2.13.jar
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
Aeriden earned 2000 total points
ID: 39227205
I am not sure why cmd.exe is being called.

Instead, create a batch file (e.g. mybatch.bat) with the following:

@echo off
cd "c:\program files (x86)\Java\jre7\bin"
java -cp m5.jar;m5-data-objects.jar;webservices-rt.jar;log4j-1.2.13.jar

Then call mybatch.bat from a command prompt (for example).
0
 

Author Closing Comment

by:lrbrister
ID: 39227220
Wow!
Was I over thinking that or what?
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 39227396
Be aware that
  cd "c:\program files (x86)\Java\jre7\bin"
just changes the current working directory on drive C:, but does not change to drive C:. Use the /D parameter to make sure you also change drives:
  cd /d "c:\program files (x86)\Java\jre7\bin"
It won't matter in this case, as you are certainly already on C:, but it is a common trap.
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:lrbrister
ID: 39228695
Qlemo,
 Thanks for the follow-up
0
 
LVL 9

Expert Comment

by:Aeriden
ID: 39230402
Yes, Qlemo brings up a good point.  I normally would do (and should have caught):

@echo off
c:
cd "\program files (x86)\Java\jre7\bin"
java -cp m5.jar;m5-data-objects.jar;webservices-rt.jar;log4j-1.2.13.jar
0
 

Author Comment

by:lrbrister
ID: 39230414
Thanks guys.  Much appreciated.
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Determining the an SCCM package name from the Package ID
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

762 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