I am trying to write a batch script where the script first finds an .exe installed somewhere on the computer then changes the working directory to the folder where that .exe is, any idea how to do that?
Asked
Active
Viewed 41 times
0
-
Nope , here the directory is known , my script first need to find where the .exe is installed in the computer then change the directory to that location . – Son May 09 '22 at 13:29
-
Does this answer your question? [A .bat or .wsh script that can search for files](https://stackoverflow.com/questions/414715/a-bat-or-wsh-script-that-can-search-for-files) but instead of generating a report, just `cd /d %%~dpG` instead of `@echo found at %%G` – SomethingDark May 09 '22 at 13:43
-
I tried the dir /s command but the output included timestamp and some other info , so reusing that as input to a variable didn't exactly work , but i see another suggestion in the comments of that question , let me try that . – Son May 09 '22 at 15:09
-
Hello Mofi , my requirement is part of the worst case , the exe i need my batch script to find is Rclone application (this is not installed ) just downloaded for their site , unzip and run . So I want my batch script to find that rclone in the drive , cd to that rclone folder then further execute the rclone commands . – Son May 10 '22 at 06:46
-
I downloaded the zip from their portal "rclone.org" , it says just to unzip and start using .now to run rclone manually i need to change the directory to where it's unzipped and start using (no issue there). But for an batch script to use rclone , first it needs to find where it's installed(as end users can unzip it anywhere)and then I can enter the required rclone commands in the batch script to be executed automatically . – Son May 11 '22 at 12:33