How can I set a batch file to find a file and show its emplacement? -
i need basic program. can far track if predefined file exists, not more. i'm trying this:
- select file
- see if exists
- find path it
- save path under variable, or that
- show path user
- (execute file, optional)
is there way it, , script? please tell me if not clear. in advance
@echo off setlocal set /p file=choose file: set /p option=do want execute file?[y/n] if "%option%" equ "y" set /p directory=directory want execute file: if "%option%" equ "y" set /p directory=directory want execute file: if not exist "%directory%\" echo directory not exist %% exit /b 3 if not exist %file% echo file not exists && exit /b 1 %%f in (%file%) ( set file_atr=%%f set full_path=%%~ff ) if "%file_atr::~0,1%" equ "d" echo directory && exit /b 2 echo full path : %full_path% if "%option%" equ "y" ( pushd %directory% call %full_path% popd ) if "%option%" equ "y" ( pushd %directory% call %full_path% popd ) endlocal
Comments
Post a Comment