帮助安装程序生成进程 [英] Help with a spawned process for an installer

查看:75
本文介绍了帮助安装程序生成进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在看似简单的问题上提供一些帮助,但我找不到解决方案。我不是一名程序员,我在IT部门工作并学会了多年前编写代码并将其用于系统维护。



我正在自动化Oracle 11g的安装程序,因此可以通过SCCM推送或手动运行,而技术人员无需选择选项或按照说明操作。 Oracle 11g安装没有问题,我创建了一个进程并告诉它启动并使用响应文件,它安装正确并且可以正常工作。



我的问题是我需要将'tnsnames.ora'配置文件复制到新创建的Oracle目录结构中,这就是问题所在。当我使用启动进程命令时,我将启动运行大约一分钟的oui.exe,然后将控制权交给执行安装的javaw.exe。在oui.exe将控制权传递给javaw.exe之后,原始进程oui.exe终止,只有javaw.exe保持运行。



因为我的Process.WaitForExit()绑定到oui.exe,我无法判断应用程序何时安装,所以我可以复制配置文件。当我在这个问题上搜索时,我发现的答案都指向用户启动的进程而不是安装程序启动的进程。除了让代码等待几分钟直到它应该被安全安装之外,有没有办法让我看到javaw.exe何时完成所以我可以复制我的配置文件?



感谢您对此问题的任何帮助。



我正在使用Visual Studio 2010使用C#和.NET 4进行编码,它适用于Windows 7计算机。

解决方案

尝试这样的事情:



  //  启动oui进程并等待它将控制权传递给javaw.exe  
流程oui = Process.Start( oui.exe);
oui.WaitForexit();

// 抓取名为javaw的流程
Process [] processes = Process.GetProcessesByName( javaw);

// 如果找到一个,为它创建一个Process实例并等到它退出
if (processes.Length > 0
{
处理javaw =进程[ 0 ];
javaw.WaitForExit();
}

else
{
// TODO:如果找不到javaw进程,则添加要运行的代码
}


非常感谢您的回复,因为这只是为了让软件部署变得简单,这将完美无缺。



再次感谢您的帮助。

I was hoping for some help on what seemed like a simple issue but I can't find a solution. I am not a coder, I work IT and learned how to code years ago and use it for system maintenance.

I am automating an installer for Oracle 11g so it can be pushed through SCCM or run manually without the techs needing to select options or follow instructions. There were no problems with the Oracle 11g install, I created a process and told it to start and used a response file and it installs properly and works as it should.

My problem is I need to copy the 'tnsnames.ora' configuration file to the newly created Oracle directory structure and this is where the issue comes about. When I use the Start process command I am launching 'oui.exe' which runs for roughly a minute and then passes control over to 'javaw.exe' which does the install. Just after oui.exe passes control to javaw.exe the original process oui.exe terminates and only javaw.exe is left running.

Because my Process.WaitForExit() is tied to oui.exe I have no way to tell when the application is installed so I can copy my config file over. When I search on this issue the answers I find are all pointing to processes that users initiate and not ones the installer initiates. Other than having the code wait for a number of minutes until it should be safely installed is there a way for me to see when javaw.exe has finished so I can copy my config file?

Thanks for any help with this issue.

I am coding this using Visual Studio 2010 using C# and .NET 4 and it is for Windows 7 machines.

解决方案

Try something like this:

// start your "oui" process and wait for it to pass control to javaw.exe
Process oui = Process.Start("oui.exe");
oui.WaitForexit();

// grab processes with the name "javaw"
Process[] processes = Process.GetProcessesByName("javaw");

// if you found one, create a Process instance for it and wait until it exits
if (processes.Length > 0)
{
    Process javaw = processes[0];
    javaw.WaitForExit();
}

else
{
    // TODO: add code to run if the javaw process is not found
}


Thank you very much for the replies, because this is just for software deployment to make life easy this will work perfectly.

Thanks again for the help.


这篇关于帮助安装程序生成进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆