, , . , .
for , , , /, .
(, " " ), for , , , , .
for %%a in ("somefile.ext?") do if /i "%%~nxa"=="somefile.ext" (
echo File exists
)
, , , .
for,
if exist "somefile.ext" (
rem your code
)
,
for %%a in ("somefile.ext") do if exist "%%~fa" (
rem your code
)
note: , , if exist "file" for %%a in ("file"), )
, .
, , , , ( , somefile.ext\ ), -
(>nul 2>&1 dir /a-d "somefile.ext") && (
echo file exists
) || (
echo file does not exist
)
, for
for %%a in ("somefile.ext") do (>nul 2>&1 dir /a-d "%%~fa") && (
echo %%~fa exists
) || (
echo %%~fa does not exist
)
dir , (/a-d) , .
note: , , , .