C# 如果我安装了多个Tortoise客户端(Git、SVN),如何获取python脚本来查找正确的Tortoise.exe?
每个tortoise客户端都有自己的名为“tortoise.exe”的可执行文件,在使用Python的subprocess.call或C#的Process类之前,我正在寻找一种区分它们的方法 我一直在使用subprocess.call()通过TortoiseSVN运行某些操作 Python:C# 如果我安装了多个Tortoise客户端(Git、SVN),如何获取python脚本来查找正确的Tortoise.exe?,c#,python,command-line,tortoisesvn,C#,Python,Command Line,Tortoisesvn,每个tortoise客户端都有自己的名为“tortoise.exe”的可执行文件,在使用Python的subprocess.call或C#的Process类之前,我正在寻找一种区分它们的方法 我一直在使用subprocess.call()通过TortoiseSVN运行某些操作 Python: call('TortoiseProc.exe /command:ignore /path:\"%s\" /closeonend:0' % url) C#: 这很好用,除非我安装了第二个(或第三个)Orto
call('TortoiseProc.exe /command:ignore /path:\"%s\" /closeonend:0' % url)
C#:
这很好用,除非我安装了第二个(或第三个)Ortoisegit客户端。我目前的解决方法是从我的Windows路径变量中删除非TortoiseSVN文件夹,但我希望找到更优雅的文件夹。作为Alexis注释的示例:
def gen_command_string(path, url):
cmd = path + 'TortoiseProc.exe /command:ignore /path:\"%s\" /closeonend:0' % url
return cmd
SVN_PATH = 'C:/Program Files/TortoiseSVN/bin'
HG_PATH = 'C:/Program Files/TortoiseHg/bin/'
cmd = gen_command_string(SVN_PATH, 'http://google.com')
call(cmd)
如果您知道每次使用哪个路径,只需使用完整的路径名作为调用SVN\u PATH='C:/Program Files/TortoiseSVN/bin'
HG\u PATH='C:/Program Files/TortoiseHg/bin/'url='url'PATH=SVN\u路径调用的第一个参数(PATH+'TortoiseProc.exe/command:ignore/PATH:\%s\'/closeonend:0'%url)仅供参考,陆龟队与陆龟队和陆龟队的指挥结构不同。
def gen_command_string(path, url):
cmd = path + 'TortoiseProc.exe /command:ignore /path:\"%s\" /closeonend:0' % url
return cmd
SVN_PATH = 'C:/Program Files/TortoiseSVN/bin'
HG_PATH = 'C:/Program Files/TortoiseHg/bin/'
cmd = gen_command_string(SVN_PATH, 'http://google.com')
call(cmd)