0

I have .bat file which works with network path using directory stack and therefore needs network privileges. My PC is member of domain. And here is strange thing: when I run batch file using double click on it - it works. If I will choose "Run as diffrent user" and enter my credentials such as DOMAIN\USER and password - this batch file works not properly. Therefore question - under which user batch file is executed when clicked? UAC is turned off I believe.

EDIT

here's batch script:

for /r %%F in (Output_AutomatedBuild\TestsResults\Coverage\*.cover.xml) do (%
xslt2xml.exe ncover2newncover.xsl %%F %%F
)

here's C# source code of xslt2xml.exe program:

class Program
{
    static void Main(string[] args)
    {
        try
        {
            XslTransform myXslTransform;
            myXslTransform = new XslTransform();
            myXslTransform.Load(args[0]);
            myXslTransform.Transform(args[1], args[2]);
        }
        catch(Exception ex)
        {
            Console.WriteLine("Exception:");
            Console.WriteLine(ex);
        }
    }
}

As you can see exception won't be thrown so exit code always be equal to zero.

10
  • It's run with the user-credentials you're typing in. But, it also highly depends on what the script is doing.
    – Vanadis
    Commented Jul 5, 2013 at 10:49
  • @Vanadis OP asks for the credentials used when running from double-click.
    – gronostaj
    Commented Jul 5, 2013 at 10:55
  • @gronostaj I'm aware of this fact. The context under which the batch-file is running, is the same as the credentials, but it's possible to run certain functions in the script as a different user, for example if he's running a 3rd-party-executable.
    – Vanadis
    Commented Jul 5, 2013 at 11:00
  • @Vanadis I will post script in few minutes
    – seeker
    Commented Jul 5, 2013 at 11:16
  • 2
    Are you sure your problem is related to permissions and not simply paths? (i.e. try using an absolute path)
    – Mat
    Commented Jul 5, 2013 at 11:37

0

You must log in to answer this question.

Browse other questions tagged .