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
Solved

command prompt batch file

Posted on 2013-06-06
6
749 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
  • 3
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
Aeriden earned 500 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 69

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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

808 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