http://www.netikka.net/tsneti/info/tscmd177.htm
All the best, Timo
--
Prof. Timo Salmi mailto:t...@uwasa.fi ftp & http://garbo.uwasa.fi/
Hpage: http://www.uwasa.fi/laskentatoimi/english/personnel/salmitimo/
Department of Accounting and Finance, University of Vaasa, Finland
Useful CMD script tricks http://www.netikka.net/tsneti/info/tscmd.htm
> DRAFT:
>
> http://www.netikka.net/tsneti/info/tscmd177.htm
>
> All the best, Timo
I would change the name to "How can I retrieve the target of a shortcut into
a variable?"
--
It looks like the Christmas Spirit threw up in our apartment.
> DRAFT:
>
> http://www.netikka.net/tsneti/info/tscmd177.htm
>
> All the best, Timo
Here's what I usually use:
::----- START -----
@ECHO OFF&SETLOCAL ENABLEEXTENSIONS
IF EXIST "%~1" (IF /I %~x1 NEQ .LNK GOTO :EOF
CALL :_) ELSE (GOTO :EOF)
FOR /F "DELIMS=" %%# IN ('CSCRIPT //NOLOGO "%%TEMP%%\_$.VBS" "%~1"') DO
ECHO %%#
DEL %TEMP%\_$.VBS&PING -n 3 127.0.0.1>NUL&GOTO :EOF
:_
>"%TEMP%\_$.vbs" ECHO WScript.Echo WScript.CreateObject^
("WScript.Shell").CreateShortcut(WScript.Arguments(0)).TargetPath
::------ END ------
The main difference from your example being that I check whether the input
file parameter (%1) is actually a shortcut before processing it.
> I would change the name to "How can I retrieve the target of a shortcut into
> a variable?"
Done. Thanks.
> Here's what I usually use:
> ::----- START -----
:
> IF EXIST "%~1" (IF /I %~x1 NEQ .LNK GOTO :EOF
> CALL :_) ELSE (GOTO :EOF)
:
> The main difference from your example being that I check whether the input
> file parameter (%1) is actually a shortcut before processing it.
Good point!