相关疑难解决方法(0)

C#(.NET 2.0)中Windows的进程间通信

我以前从未在Windows上做过IPC.目前我正在开发一对程序,一个标准的GUI/CLI应用程序和一个Windows服务.该应用程序必须告诉服务该做什么.因此,假设通信只是本地通信,那么这两个进程的最佳通信方法是什么?

最好的地方被定义为更健壮,更不容易出错,不是最高性能也不是最容易编码.

代码示例将非常受欢迎,但不是必需的:-)

注意我只是询问使用什么,标准TCP套接字,命名管道或其他一些通信方式.

谢谢!

.net c# ipc

52
推荐指数
2
解决办法
5万
查看次数

如何从用户将字符串输入到批处理文件的环境变量中

我想提示用户输入一些输入细节,然后将其用作命令行参数.

cmd input batch-file

31
推荐指数
1
解决办法
15万
查看次数

使用C#使用相同的进程执行多个命令行

嗨,根据我在这里的最后一个问题,我尝试编写一个sql编辑器或类似的东西,这样我尝试从C#连接到CMD并执行我的命令.现在我的问题是我连接到SQLPLUS后,我无法获得SQLPLUS命令,我审查的其他资源不满足我.请帮助我如何在连接到sqlplus之后,我可以在我的进程中运行我的sql命令吗?现在我用这个代码:

//Create process
System.Diagnostics.Process pProcess = new System.Diagnostics.Process();

//strCommand is path and file name of command to run
pProcess.StartInfo.FileName = strCommand;

//strCommandParameters are parameters to pass to program
pProcess.StartInfo.Arguments = strCommandParameters;

pProcess.StartInfo.UseShellExecute = false;

//Set output of program to be written to process output stream
pProcess.StartInfo.RedirectStandardOutput = true;

//Optional
pProcess.StartInfo.WorkingDirectory = strWorkingDirectory;

//Start the process
pProcess.Start();

//Get program output
string strOutput = pProcess.StandardOutput.ReadToEnd();

//Wait for process to finish
pProcess.WaitForExit();
Run Code Online (Sandbox Code Playgroud)

我定制了它.我分开初始化,我创建过程对象一次我还有问题,运行第二个命令我使用这些代码进行第二次调用:

pProcess.StartInfo.FileName = strCommand;

//strCommandParameters are parameters …
Run Code Online (Sandbox Code Playgroud)

c# command

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×2

.net ×1

batch-file ×1

cmd ×1

command ×1

input ×1

ipc ×1