Here is a workaround. Save this as "SetMyPath.bat" (or with a different name):
@echo off set dir=%* setlocal EnableDelayedExpansion for /f "delims=" %%i in ('dir /s /ad /o:d /b "%dir:"=%"') do set path=%%i;!path! cmd
(Here, "%dir:"=%" is only required so that you can exclude quotation marks around directories with a space in the names when calling this file. If you do not need this, it will be %1 instead).
This file takes one command line argument: directory. It will launch a new copy of cmd.exe , where the files under this directory will be available:
C:\> mysqldump.exe File not found. C:\> SetMyPath.bat C:\Program Files\MySQL Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\> mysqldump.exe Usage: mysqldump [OPTIONS] database [tables] C:\> exit
In this example, the first command shows that mysqldump.exe not in the path. After executing the batch file, a new cmd.exe is launched, where mysqldump.exe is available. When you finish working with it, exit will return the original copy of cmd.exe .
If there are two copies of the .exe file in different subdirectories, a copy will be launched in the last updated directory (due to /o:d ). In this example, assuming that the directory for the latest MySQL version was updated last, the most recent version of mysqldump.exe will be launched.
The batch file can be modified to ensure that the most recent copy of .exe is launched (ask me in the comments if you need it).
source share