Rui
Rui

Reputation: 386

Getting execption whenever it runs from process.start

so im having this weird issue with a win 7 pc. I have this application that runs this powershell script from a .bat file. This is the code:

public void GetLastestEarthBackground()
{
    var directoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Scripts");
    var vbsFile = Path.Combine(directoryPath, Settings.VBSFileName);

    if (File.Exists(vbsFile))
    {
        var process = new Process
        {
            StartInfo =
            {
                WorkingDirectory = directoryPath,
                Verb = "runas",
                UseShellExecute = true,
                FileName = "run.bat", //Settings.VBSFileName,
                Arguments = "//B //Nologo"
            }
        };
        process.Start();
        process.WaitForExit();
    }
}

When i run it from my application i see this in the command line:

enter image description here

But if i double click on the batch file i get this resut:

enter image description here

Any ideas?

Upvotes: 0

Views: 35

Answers (1)

Klas Svensson
Klas Svensson

Reputation: 21

This seems like a issue with user rights, the program running the script probably does not have the same rights as your user.

Upvotes: 1

Related Questions