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.


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)
            XslTransform myXslTransform;
            myXslTransform = new XslTransform();
            myXslTransform.Transform(args[1], args[2]);
        catch(Exception ex)

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

  • It's run with the user-credentials you're typing in. But, it also highly depends on what the script is doing. – Vanadis Jul 5 '13 at 10:49
  • @Vanadis OP asks for the credentials used when running from double-click. – gronostaj Jul 5 '13 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 Jul 5 '13 at 11:00
  • @Vanadis I will post script in few minutes – seeker Jul 5 '13 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 Jul 5 '13 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.