Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The process for verifying the presence of file(s) in a particular folder using Windows batch is as follows:

  1. Open Notepad or any text editor.
  2. Type the following code in the text editor:

@echo off set /p folder="Enter folder path: " if exist "%folder%\" ( echo Folder exists set /p file="Enter file name: " if exist "%folder%\%file%" ( echo File exists ) else ( echo File not found ) ) else ( echo Folder not found )

  1. Save the file with .bat extension, for example, VerifyFiles.bat.
  2. Double-click the file to run it.
  3. Enter the folder path when prompted.
  4. Enter the file name when prompted.
  5. The script will check if the folder and file exist and provide the appropriate message.