开发者

Permission issues when running JScript from C# Console application

I'm trying to run a Jscript task from a C# console application.

The Jscipt file is not mine so I can't change it. The script moves some files and this is what is causing the issues.

When I run the script manually, i.e. form the shell it executes correctly. When I try and run the script from my console application the bulk of the process runs but I get a ":Error = Permission denied" error when it tries to move the files.

I've tried every permutation of the Diagnostics.Process class that I can think of but I've had no luck.

My current code:

Process process = new Process();

process.StartInfo.WorkingDirectory = Path.GetDirectoryName((string)path);
pro开发者_如何学运维cess.StartInfo.FileName = @"cmd.exe";
process.StartInfo.Arguments = "/C " + (string)path;

process.StartInfo.UseShellExecute = false;
process.StartInfo.Verb = "runas";

process.StartInfo.LoadUserProfile = true;

process.StartInfo.Domain = "admin";
process.StartInfo.UserName = @"cardax_sync_test";
process.StartInfo.Password = GetSecureString("abc123");

process.Start();

process.WaitForExit();

Any ideas?

Thanx


Rookie Mistake!

I forgot to close the text reader that creates one of the input files for the jscript.

I'll submit this question for deletion when it get's old enough. Don't want more useless info clogging up the net!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜