300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > python的安装包打不开_msiexec无法打开此安装程序包

python的安装包打不开_msiexec无法打开此安装程序包

时间:2020-04-14 21:15:37

相关推荐

python的安装包打不开_msiexec无法打开此安装程序包

【 - 其它综合】

在编写应用程序宿主程序(支持自动部署与自动升级)时,需要在安装过程中安装vc runtime以及python环境,所以调用想调用 ""\"c:/windows/system32/msiexec.exe\" /i E:/Software/python-3.3.0.msi"".总是弹出“无法打开此安装程序包。请确认该程序包存在,并且您有权访问它,或者与应用程序供应商联系,以确认这是一个有效的 Windows Installer 程序包。”,经过两天的测试,终于摸索出以下规律.调用流程如下:

char szCommandLine[MAX_PATH] = "\"c:/windows/system32/msiexec.exe\" /i E:/Software/python-3.3.0.msi";

STARTUPINFO si;

ZeroMemory(&si, sizeof(si));

si.cb = sizeof(si);

PROCESS_INFORMATION pi;

if(CreateProcess(NULL,szCommandLine,NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))

{

CloseHandle(pi.hProcess);

CloseHandle(pi.hThread);

}

1、char szCommandLine[MAX_PATH] = "\"c:/windows/system32/msiexec.exe\" /i E:/Software/python-3.3.0.msi" : 出错

2、char szCommandLine[MAX_PATH] = "\"c:/windows/system32/msiexec.exe\" /i E:\\Software/python-3.3.0.msi" : 正确

3、char szCommandLine[MAX_PATH] = "\"c:/windows/system32/msiexec.exe\" /i E:\\Software\\python-3.3.0.msi" : 正确

4、char szCommandLine[MAX_PATH] = "\"c:/windows/system32\\msiexec.exe\" /i E:\\Software\\python-3.3.0.msi" : 正确

5、char szCommandLine[MAX_PATH] = "\"c:/windows\\system32\\msiexec.exe\" /i E:\\Software\\python-3.3.0.msi" : 正确

6、char szCommandLine[MAX_PATH] = "\"c:\\windows\\system32\\msiexec.exe\" /i E:\\Software\\python-3.3.0.msi" : 正确

结论:

对于"msiexec"而言,解析安装包目录时,驱动符号后面的目录分隔符必须是'\\'而不能是'/'。也再一次印证了原先的感概:微软,我心中永远的痛 - 错与不错看心情,导与不导看运气,有时是向导,有时是误导。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。