I found this code here --> ::Check if the path is File or Folder using batch
But I find it hard to read and want to simplify it/break it apart. I'm not sure how to do this, I tried the below and a few variations to no avail. Can anybody help? Thanks!
This code works:
@Echo Off
Set "ATTR=D:\Download\Documents\New"
For %%Z In ("%ATTR%") Do If "%%~aZ" GEq "d" (Echo Directory
) Else If "%%~aZ" GEq "-" (Echo File) Else Echo Inaccessible
Pause
This is what I would like it to look like, but can't figure out:
@echo off
set "ATTR=%AppData%\Microsoft\Excel\XLSTART"
For %%Z In ("%ATTR%") Do If "%%~aZ" GEq "d" GoTo DIR
Else If "%%~aZ" GEq "-" GoTo FILE
Else GoTo NOTFOUND
:DIR
Echo "Dir Found!"
Pause
:FILE
Echo "File Found!"
Pause
:NOTFOUND
Echo "NOTHING FOUND!"
Pause