This works:
if exist %1* echo Directory
Works with directory names that contains spaces:
C:>if exist "c:Program Files*" echo Directory
Directory
Note that the quotes are necessary if the directory contains spaces:
C:>if exist c:Program Files* echo Directory
Can also be expressed as:
C:>SET D="C:Program Files"
C:>if exist %D%* echo Directory
Directory
This is safe to try at home, kids!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…