Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个通过命令提示符mysql.exe和mysqldump.exe. 这个想法是进行备份,然后将其上传到具有不同数据库名称的 mysql。 问题是我不认为如果这些mysql.exe并且mysqldump.exe没有在 cmd 中注册并且您必须手动键入它们的路径会发生什么。 我的申请中断了。 所以我想知道是否有任何自动方法可以找到这两个文件的路径以正确运行它们。 我想到的另一个解决方案是让用户浏览他的文件并选择这些可执行文件。
mysql.exe
mysqldump.exe
要管理此路径,您可以使用环境变量并从应用程序中获取它。
string sPath = System.Environment.GetEnvironmentVariable("MYSQL_DIR");
其他解决方案是将两个可执行文件复制到您的应用程序路径并使用相对路径访问它们。
string sPath = "./";
希望能帮助到你。