Hello, Using "start shortcut-name" can open the shortcut related software in dos console window. But if "start shortcut-name" is used in "system exec", it displays "memory is full"; if "cmd /k start \file path\shortcut-name", only the dos window displays a short time, and the needed software is not opened.
I needed to launch a third party application recently to run along side my application.
The code I used is shown in the attached jpg. Ignore the function following the system exec, it just logs errors if they occur.
I just copied the command line that was displayed when I did a right-click >>> properties on the the shortcut.
The copied string is what you see in my example. The other booleans are set such that the application shows it GUI and the system exec returns after launching.
The syntax of the start command is tricky and depends of Windows flavor. If the target path contains spaces it must be enclosed in quotes. I'm on Win98 now and the command start "c:\my program.lnk" works.
However, on Win 2K/XP I think it must be start "" "c:\my program.lnk" because the first argument with quotes is the window title.
Hello Ben and Jean-Pierre Drolet, Thank you for your reply! The reason using a shortcut in "system exec" is that I want to start a modem connection by the program. If I right click the shortcut, only "Target location: network connection", and there is no exe file related to this shortcut.
Since there is no empty space in my folder name, "" seems not needed in my xp computer.
I have checked that "cmd /k start d:\startmodem" can start the connection if startmodem is the shortcut name of the network connection. The only problem is that I need manually close the dos window. If "/c" is used instead of "/k", the connection window doesn't appear, only the dos window appears a short time.
It might help to put the command in a batch file and execute the file. In the command file, put a "pause" command at the end to see eventual error message. Don't forget the *.lnk extension.
What is the actual command you are trying to execute?
Hello Jean-Pierre Drolet, The actural command is to start the modem network connection. If the related file of the shortcut is an exe file, the "system exec" can work well. For the network connection which has no specified file related, I have to use "cmd /k start startmodem". I tried to put the shortcut in a bat file. It seems that they are similar. The pause used in the bat file didn't display the reason. Thank you anyway!