1.

Solve : if exist doesn't work in some cases (?

Answer»

Hello,
when I try to proof if a *.lnk FILE EXIST in the following path it doesn't work.
It works on other (shorter) paths.
Is the path to long?
Is there a workaround for this problem?
(OS is NT4)

snip---------------
set PC=marvin
if exist "\\%PC%\c$\WINNT\Profiles\All Users\Start*\Programme\Front End\logon.lnk" (echo logon.lnk OK)

----------snap

uliQuote

if exist "\\%PC%\c$\WINNT\Profiles\All Users\Start[highlight]*[/highlight]\Programme\Front End\logon.lnk" (echo logon.lnk OK)
I suspect the problem is with the wildcard in the middle of the path. A little testing shows wildcards only seem to work at the end of the path.

Code: [SELECT]if exist "\\%PC%\c$\WINNT\Profiles\All Users\Start\Programme\Front End\logon.[highlight]*[/highlight]" (echo logon.lnk OK)
8-)

Tested on XP SP2 but should be BACKWARD compatible.Many thanks Sidewinder.

The easiest solutions are often the best. :-)

(I used the wildcard cause of the ü, (no ascii letter), makes sometimes trouble.)

uli


Discussion

No Comment Found