Target file must be in UNC format Error

Hi everyone,

While running the batch process i am getting “Target file must be in UNC format” error.

because this batch will create a file and will save the same in to the specified folder(path) which is entered by user.

The same process is working fine when i run normally(without selecting batch process).


can anyone tell me the solution for this.

Siva Mohan


Is the batch process running in the server? If so, then most likely the server is not able to access the path. You can verify this by hard coding a path which is accessible to the server and then running the batch.

One option is instead of letting users specify the path, you can create a parameter field and store the path in this field. But first make sure server can access the path without any error.

Hi Harish,

Thanks for your reply…

I am working on Standalone system…

here is the code which i am using

as you said, i tried with hard coding. but it was not working and the same error message am getting.

can u suggest me where did i do mistake.


Siva Mohan Y

  1. “SON15882\D:\Test\Cust.txt” in not an UNC path. It would be something like @"\SON15882\D$\Test\Cust.txt" (assuming that SON15882 is a computer name)

  2. Although I use administrative share (D$) above, you should create a separate shared folder (with proper security setup).

  3. “@” means that you don’t need to escape special characters, therefore @"\" is equivalent of “\\”.

Hi Martin,

I gave the UNC path for file (fileName = @\SON15882\D$\Test\Cust.txt;) and i run the Batch Process.

but now i am getting the below error.

"Unable to open file \SON15882\D$\Test\Cust.txt**"**

can you please tell me that why it is coming and what will be solution?


Siva Mohan


If it is standalone system, provide the file path like this - ‘D:\Test\’.

Also use WinAPI function to check whether the path exists or not. See sample code below -

static void testFilePath(Args _args)

FilePath filePath;
FileIOPermission pathPermission;

filePath = ‘D:\Test’;
pathPermission = new FileIOPermission(filePath, ‘r’);

if (WinAPI::pathExists(filePath))
info (‘success’);

NOTE - you can also use pathExists method in winAPIServer class.

UNC path is the common path that should be shared by all the users in the company. Make sure that path is accessible to all the users.

What are usual problems with opening files?

  1. The path is not correct (verify from the command line or so)
  2. User has not enough rights (the user is the AOS service and I it really shouldn’t have access via administrative sharing (D$) - create a new shared folder and set appropriate rights for the AOS service)
  3. The network access between those two machines does not work (many reasons)

Did you make it, to run reports in batch?

Seems like it’s not possible to run client side batch tasks on the server, without doing any customizations, from what I found here:

I’m using UNC format and user rights are ok, but I still get the error message ‘unable to open’.


I am encountering the same problem. Though i have a proper UNC path the system is throwing an error

Target file must be in UNC format Error if the job is run as a batch.

Does any one has solution how to run a batch job to save reports in pdf format run as Job on Server ?. I am getting error at method.