Portable .LNK files

Discuss anything related to portable freeware here.
Message
Author
User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

Portable .LNK files

#1 Post by m^(2) »

Motivated by a recent Lifehacker article at the topic, I decided to do something about ubiquitous misinformation that .lnk files aren't (and can't be) portable.
Really, they usually aren't, but CAN be.
I wrote a quick and dirty program, that generates portable .lnks.
Get it.
Last edited by m^(2) on Mon Jul 28, 2008 1:22 am, edited 2 times in total.

ashghost
Posts: 384
Joined: Wed Feb 06, 2008 2:55 pm
Location: South Carolina

#2 Post by ashghost »

I get this error:

lnker.exe is not a valid Win32 application.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#3 Post by m^(2) »

upx -d lnker.exe
It seems that UPX has troubles with it, I'll update the archive and submit this to UPX devs shortly.
EDIT: Done.

Island Boy
Posts: 123
Joined: Wed Sep 19, 2007 7:56 pm

#4 Post by Island Boy »

m^2 said
This article is wrong,
http://lifehacker.com/399293/create-sho ... -usb-drive
you CAN create relative shortcuts. No batches are needed.
Sample: A .lnk that opens a.txt in own directory.

MIME-Version: 1.0
Content-Type: application/octet-stream; name=”a.txt.lnk”
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=”a.txt.lnk”

TAAAAAEUAgAAAAAAwAAAAAAAAEaKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAQAAAAAAAAAAAAAAAAAAAAQAAAAFAGEALgB0AHgAdAA
please explane the above in newbe talk, step by step.


Also how does one work this "lnker.exe" app, step by step.[/quote]

ashghost
Posts: 384
Joined: Wed Feb 06, 2008 2:55 pm
Location: South Carolina

#5 Post by ashghost »

I did some searching and figured out a workaround to make shortcuts that use relative paths. :D Unfortunately, this workaround still flashes a command window before launching the target.

To start siw.exe using a shortcut placed in the same directory, enter the following as the target:

Code: Select all

%windir%\system32\cmd.exe "/C start siw.exe"
and then enter %cd% as the "Start In" directory.

If siw.exe is in the SIW subdirectory of where you place the shortcut, the target will be:

Code: Select all

%windir%\system32\cmd.exe "/C start SIW/siw.exe"
Likewise, to link to SIW in a parallel directory:

Code: Select all

%windir%\system32\cmd.exe "/C start ../SIW/siw.exe"
The above only works on Windows NT and later. To do this on Win 95, 98, or ME, you can enter start.exe instead of cmd.exe /C start:

Code: Select all

%windir%\system32\start.exe "siw.exe"
If you want to use the same shortcuts on XP and 98, you're out of luck.



I found information on this page under the heading "file management", but it pertains only to Windows 95, 98, and ME, so I combined it with info from this page.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#6 Post by m^(2) »

Shortcuts let you define window application's window state.
Try to run it minimized.
BTW lnker shortcuts are probably not compatible with Windows 9x, however it is possible to modify this.
Then the same shortcut will work with all Windows versions, at least since 95.

appsuser
Posts: 136
Joined: Fri Feb 08, 2008 11:51 pm

#7 Post by appsuser »

ashghost wrote: If you want to use the same shortcuts on XP and 98, you're out of luck.
I'm not sure, but couldn't you use nircmd.exe instead of cmd.exe or start.exe to make this run on all platforms?

http://www.nirsoft.net/utils/nircmd.html

With the "execmd" option, it won't even display anything on the screen.

ashghost
Posts: 384
Joined: Wed Feb 06, 2008 2:55 pm
Location: South Carolina

#8 Post by ashghost »

appsuser wrote:I'm not sure, but couldn't you use nircmd.exe instead of cmd.exe or start.exe to make this run on all platforms?
You could, and I was aware of it, but you would need to have nircmd installed on every machine you use, since you couldn't have a persistent path to nircmd.exe on your usb drive.

@m^(2) Thanks for pointing that out. I had realized it myself by the time I read your post.

alanbcohen
Posts: 82
Joined: Tue Feb 13, 2007 2:40 pm

Re: Portable .lnk files

#9 Post by alanbcohen »

m^(2) wrote:Motivated by a recent Lifehacker article at the topic, I decided to do something about ubiquitous misinformation that .lnk files aren't (and can't be) portable.
Really, they usually aren't, but CAN be.
I wrote a quick and dirty program, that generates portable .lnks.
Get it.
ADDED: It seems that my server has some issues now and the link doesn't work.
Temporary download: Get it.
I figured out how to use lnker. The readme files says:

Code: Select all

lnker .\prog\prog.exe
The problem is that a command line utility would seem to need two parameters; the name of the link created and the command to be executed. So, I tried from a command prompt:
lnker linker.ink lnker.exe
and it successfully created a link - after I downloaded and installed:
msvcp60d.dll (not present on my WinXPSP2 system)

Next question might be; is there a way to create a link from the GUI without opening a command prompt window?

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#10 Post by m^(2) »

No, there's no GUI and I don't intend to write it.
If somebody wants to do it, I say: go on, I can even offer some help.

The use of MSVCP60D.dll is a bug, it should be (much more common) MSVCP60.dll instead. I'll fix it shortly.
EDIT: Fixed.

alanbcohen
Posts: 82
Joined: Tue Feb 13, 2007 2:40 pm

#11 Post by alanbcohen »

Glad I could help (find a bug). I'll be monitoring the forums for some else's GUI; I'm not competent with Windows programming.

Island Boy
Posts: 123
Joined: Wed Sep 19, 2007 7:56 pm

How one works lnker, step by step guide.

#12 Post by Island Boy »

How one works lnker, step by step guide.

1. Create a text file (.TXT) in the same folder as lnker.exe

2. Type the following to text file & save.
lnker .\prog\prog.exe
(that's the "file path" from intended link location to program file)
n.b. File path must not contain "&" (Bug?)

3. Rename the text file and change the extension to .BAT instead of .TXT

4. Run .BAT file.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

Re: How one works lnker, step by step guide.

#13 Post by m^(2) »

Island Boy wrote: File path must not contain "&" (Bug?).
Yes, it is a bug, you can't pass this sign in a command line unless it's enclosed in double quotes ("a&b.exe"), but such parameters aren't handled by lnker.
It's a minor thing and I don't intend to fix it though, sorry.
ADDED: I found a workaround. Create a shortcut to lnker.exe (usual, not portable one) and in the "target" field type:
C:\lnker.exe a&b.txt

Island Boy
Posts: 123
Joined: Wed Sep 19, 2007 7:56 pm

Seems to work well, but ...

#14 Post by Island Boy »

Seems to work well as long as lnker.exe is not placed in any folder,

e.g. C:\lnker.exe or F:\lnker.exe or the like.

I can live with it.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#15 Post by m^(2) »

What is the problem when it's in a directory?
There shouldn't be any issues.

Post Reply