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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started