Ask Your Question
4

What is the process for verifying the presence of file(s) (excluding "A"/"THE" file) in a particular folder using Windows batch?

asked 2022-07-27 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-03-13 22:00:00 +0000

qstack gravatar image

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.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-07-27 11:00:00 +0000

Seen: 15 times

Last updated: Mar 13 '22