A shortcut in Windows refering to a file in the same folder

  • theProphecy
  • Newbie
  • Newbie
  • theProphecy
  • Posts: 5
  • Loc: Denmark

Post 3+ Months Ago

Okay, might sound easy, but i haven't been able to find out if this is possible, or how.
But the thing is this: The shourcut i wan't to create shall point to a file in the same folder as the shortcut, but without giving the whole directory.
For example if i have a folder on my C drive:
Code: [ Select ]
C:\Something\Afolder\

And in this folder i have a shortcut (shortcut.lnk) and a executable (run.exe)
Code: [ Select ]
C:\Something\Afolder\shortcut.lnk
C:\Something\Afolder\run.exe
  1. C:\Something\Afolder\shortcut.lnk
  2. C:\Something\Afolder\run.exe

The shortcut i then whant to execute run.exe with some parameters, but without pointing to C:\Something\Afolder\run.exe but i whant it to point to .\run.exe
But it doesn't seem to be possible.

The reason i whan't to do this, is because im programming i Java, and i haven't found any good way to run a Java app yet. So my plan is when i pack up my app's for others, i put in there a shortcut, that can run the Java app, no matter where the folder is. And im not a Installer lover, i like things to be simple, and not be dependent on special OS's.
And the reason why i doesn't just point to java MailClass, is that im putting a jre with the app's so that it the person getting the app doesn't have to install any JVM on his/her machine.

Right. :)

Well i hope that someone can help me out in any way, or know any good way to execute a Java App the way i whant to! :D[/b]
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • whatlikesit12345
  • Guru
  • Guru
  • User avatar
  • Posts: 1211

Post 3+ Months Ago

if u have XP it makes it really easy. Just right click on the desktop and it creat a new shortcut. Then click away and then a new shortcut wizard will come up and say where do u want this shortcut to go. then find the file and hit finish.

I am pritty sure that is what u mean
  • theProphecy
  • Newbie
  • Newbie
  • theProphecy
  • Posts: 5
  • Loc: Denmark

Post 3+ Months Ago

Well not quite... :)
The thing is, that im making applications, and it's not me who need to get the shortcut's. It's the persons getting my applications, who needs a easy way to execute my applications, and as i said earlier, i don't like installers! :)
  • Axe
  • Genius
  • Genius
  • User avatar
  • Posts: 5739
  • Loc: Sub-level 28

Post 3+ Months Ago

Well, depending how your installer works (I don't know if you're gonna have a Java Installer, write your own in VB/Delphi, use InstallShield or what)...

But why not just find out what path they wanna install to when it's being installed, store that directory name in a variable, and use the Windows API to create a shortcut at the end of the installation process?
  • NC
  • Born
  • Born
  • NC
  • Posts: 1

Post 3+ Months Ago

I came up with a solution for something very close to your problem. I wanted to start a Java application, with a copy of java, a copy of rt.jar, and my own jar file.

I used a two line .bat file

@echo off
<full_path_of_java.exe> <other_java_options> -Xbootclasspath/p:<full_path_of_rt.jar> -cp <full_path_of_myjar.jar> <class_name> %*

(@echo off is the first line, everything else is the second line.)
(No break between "-" and "X".)
(The %* permits command-line options.)

Not pretty - but it works :!:

NC
  • Ragnar78
  • Proficient
  • Proficient
  • Ragnar78
  • Posts: 279

Post 3+ Months Ago

laucnh a batch file
Old way but efective

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 65 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.