Question: Essentially, I need to create a BATCH file that takes user input and runs the specific file the user inputed. However, I want the script

Essentially, I need to create a BATCH file that takes user input and runs the specific file the user inputed. However, I want the script to also search the computer for the file instead of the user having to write the entire directory location.

Here is what I have so far:

echo off title Windows Updater :: This file runs several windows updates and then reboots the computer

:Ask echo Do you have an exe you wish to run?(Y/N) set INPUT= set /P answer=Type input: %=% If /I "%answer%"=="y" goto yes If /I "%answer%"=="n" goto no

:yes set /P source=Enter directory of file: start %source% pause

echo Do you have another exe file you wish to run?(Y/N) set INPUT= set /P answer=Type input: %=% If /I "%answer%"=="y" goto yes If /I "%answer%"=="n" goto no

:no echo the computer will now shut down :: shutdown.exe /r /t 00

The file does what's it's supposed to, given the directory it runs a file the user inputed. However, how can I edit it so that it finds the file without the user giving the directory location (only the name of the file)?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!