Can I run a shortcut from a batch file?

Muse

Lifer
Jul 11, 2001
39,937
9,623
136
Windows, and I have a batch file that runs an EXE, but I need to run a shortcut to the EXE because I need the Start In feature of shortcuts. I don't see a Start In option for running EXEs other than using shortcuts.
 

seemingly random

Diamond Member
Oct 10, 2007
5,277
0
0
Anything that can be run from the command line can be included in a batch file.

I just did start /? from the command line and it looks like there might be something useful there.

help from the command line gives a list and brief description of most commands available in ms-windows.
 

Muse

Lifer
Jul 11, 2001
39,937
9,623
136
Originally posted by: seemingly random
Anything that can be run from the command line can be included in a batch file.

I just did start /? from the command line and it looks like there might be something useful there.

help from the command line gives a list and brief description of most commands available in ms-windows.

Hmm. I got the idea of doing it in a programming language I'm familiar with, being MS FoxPro. I'm 99+% positive I can launch my EXE from code, first doing the stuff I would have done in a batch file. Might be faster, too.
 

postmortemIA

Diamond Member
Jul 11, 2006
7,721
40
91
Programming languages have interface to create processes. During process creation, you can specify execution directory, that is what you meant as "start in"

For example, in Java:
java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#exec%28java.lang.String,%20java.lang.String[],%20java.io.File%29

In C/C++ on windows:
http://msdn.microsoft.com/en-u...682425%28VS.85%29.aspx
 

playcasual

Junior Member
Aug 29, 2009
1
0
0
Ya I too agree postmortemIA suggestion every programming language need specific package and interface we need to specify the path.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,566
4,481
75
If that's what you mean by "start in", the batch file way to do it is to "cd" to the "start in" directory, then run the executable from its full path.

cd c:\my\start\in\directory
c:\my\program\directory\my_program.exe
 

Muse

Lifer
Jul 11, 2001
39,937
9,623
136
Originally posted by: Ken g6
If that's what you mean by "start in", the batch file way to do it is to "cd" to the "start in" directory, then run the executable from its full path.

cd c:\my\start\in\directory
c:\my\program\directory\my_program.exe

Ah, OK that might work. Someone said this would work, at least for this program:

Execute the following:

c:\my\program\directory\my_program.exe <data_drive>:\mydata\my_programdata

The object is to get the program to use a specific data location, in this case on another computer on the LAN. I haven't tried this yet, but I suppose it will work. What I have done until just now is run the executable on the other machine. It works OK once the executable loads, but it loads kind of slowly.