当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Calling a script with program files

问题描述:

I am trying to call a script that is located in program files but it wont work...I believe the problem is in the fact that it doesn't recognize the directory "Program Files" but I don't know how to solve this very basic mistake.

ProcessStartInfo(@"C:\Program Files\Scripts\bin\scriptmgr", "--dts" + filename);

网友答案:

Do you have a missing space?

ProcessStartInfo(@"C:\Program Files\Scripts\bin\scriptmgr", "--dts " + filename);
                                                                  ^
网友答案:

You could try using an environment variable such as

        ProcessStartInfo pInfo = new ProcessStartInfo(@"%programfiles%\Scripts\bin\scriptmgr\" + fileName);
        pInfo.Arguments = "--dts";
        Process.Start(pInfo);

and using ProcessStartInfo to specify the arguments/other variables

分享给朋友:
您可能感兴趣的文章:
随机阅读: