I need a batch that will tell the targets path from dragging a lnk file on to it ...
thanks
Page 1 of 1
lnk file target path batch
#2
Posted 09 October 2009 - 06:25 AM
This should do:
jaclaz
@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
#3
Posted 09 October 2009 - 07:44 AM
The following works with Win7 shortcuts.
@More "%~dpn1.lnk" 2>Nul|Findstr ":\\."&&Ping -n 6 127.0.0.1>NulJust drag and drop the shortcut onto it to see it in action.
#4
Posted 09 October 2009 - 10:07 AM
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
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
#5
Posted 03 January 2010 - 07:55 PM
first-of thanks for the help guys
Had problems posting lately &thanks is due...
now to further refine Yzöwl's code that worked here in batch :
from the current batch output result * how to omit just the "\target.file" (from the right end of the line & so that only the path folder directory is shown.)
thanks
Had problems posting lately &thanks is due...
now to further refine Yzöwl's code that worked here in batch :
from the current batch output result * how to omit just the "\target.file" (from the right end of the line & so that only the path folder directory is shown.)
thanks
#6
Posted 04 January 2010 - 06:53 AM
You'll need to use a few more lines by implementing a 'For loop'
Something like this should do:
Something like this should do:
@Echo off & Setlocal & Set "P_="
If "%~1" Neq "" (If Exist "%~1" (If /I %~x1 Equ .lnk (
For /F "tokens=*" %%# In ('More "%~f1"^|Findstr ":\\."') Do (
Set "P_=%%~dp#"))))
If Defined P_ (Set "P_=%P_:~,-1%" & Call Echo/%%P_%% & Ping -n 6 127.0.0.1>Nul)
#7
Posted 24 February 2010 - 07:02 AM
so far this worked perfectly for me .. thanks again!
- ← My C# and VS.NET2k8 headache thread
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- Code help need please. →
Share this topic:
Page 1 of 1



Help
Back to top









