简体   繁体   English

C#中的VB6等效代码

[英]VB6's equivalent code in C#

This is a sample code which I have to convert in C#. 这是示例代码,我必须在C#中进行转换。 As this code was written long ago and I don't have deep idea about VB, it will be really helpful if a C# version is given. 由于这段代码是很久以前编写的,而且我对VB并不了解,因此如果提供C#版本将非常有帮助。

The code: 编码:

ChDir ("c:\folder")
a = Shell("c:\folder\some.exe C /LINK ", 1)        
Sleep 6000   'Implements a 1 second delay
sParameters = "Something"
a = ExecCmd(sParameters)

I have searched on MSDN and saw what Shell does, but I am still confused. 我在MSDN上进行了搜索,看到了Shell的作用,但我仍然感到困惑。 Please help me. 请帮我。

Search about 搜索关于

Process.Start("c:\folder\some.ex");

If your app needs arguments : 如果您的应用需要参数:

ProcessStartInfo si= new processStartInfo();
si.fileName="c:\folder\some.exe";
si.CreateNoWindow = false;
si.UseShellExecute = false;

si.WindowStyle = ProcessWindowStyle.Hidden;
si.arguments="arguments here";
try
    {
        // Start the process with the info we specified.
        // Call WaitForExit and then the using statement will close.
        using (Process exeProcess = Process.Start(si))
        {
        exeProcess.WaitForExit();
        }
    }
    catch
    {
        // Log error.
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM