Help - Search - Members - Calendar
Full Version: lnk file target path
MSFN Forums > Coding, Scripting and Servers > Programming (C++, Delphi, VB, etc.)

   


Google Internet Forums Unattended CD/DVD Guide
sweept

I need a batch that will tell the targets path from dragging a lnk file on to it ...

thanks
jaclaz
This should do:
CODE
@ECHO OFF
IF %1.==. GOTO :EOF
IF NOT EXIST %~dpnx1 GOTO :EOF
ECHO %~dpnx1
IF NOT %~x1.==.lnk. GOTO :EOF
more %~dpnx1 | FIND ":\" | FIND /V "/"
pause


jaclaz
Yzöwl
The following works with Win7 shortcuts.
CODE
@More "%~dpn1.lnk" 2>Nul|Findstr ":\\."&&Ping -n 6 127.0.0.1>Nul
Just drag and drop the shortcut onto it to see it in action.
gunsmokingman
Here is the VBS script way of getting the lnk path. This script can handle multiple .lnk files being drag and drop on to it self.

QUOTE
CODE
Dim Obj, Act :Set Act = CreateObject("WScript.Shell")
   If Not Wscript.Arguments.Count = 0 Then
    For Each Obj In WScript.Arguments
     If InStr(LCase(obj),LCase(".lnk")) Then
       Act.Popup vbCrLf & Act.CreateShortcut(obj).TargetPath,5,"ShortCut Path",4128
     End If
    Next
   End If




Google Internet Forums Unattended CD/DVD Guide

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.