I'm trying to test a variable with If/Exist and have this working:
@echo off
set src_fullpath="C:\Users\myID\Data\excelfile.xlsx"
if exist %src_fullpath% (
echo file exists
pause
exit /b
) else (
echo file does not exist
pause
exit /b
)
...Now I want to make the path and filename (with a date in excel file) captured in a variable, something like this below (but it's not working correctly)...
@echo off
set src_path=C:\Users\%username%\Data\
set src_file=excelfile.xlsx
set src_fullpath=%src_path%%src_file%
if exist %src_fullpath% (
echo file exits
pause
exit /b
) else (
echo file does not exist
pause
exit /b
)
What am I doing wrong? I've messed around and added "" to the set variables, but that doesn't work the way it should.
Aucun commentaire:
Enregistrer un commentaire