Because .bat files are executable, I call all of my bat files as so:
exec('E:\\Subsidiary\\Sub.bat', '', 4);
Oh, and I think because the third parameter in exec() is a “4” DI is not raising an exception and, thus, allowing the job to complete successfully regardless of whether the bat file completed successfully.
Yes, I mainly work on the server (in which DI is Installed) itself. With the same login only I manually Executed the Batch file and Executed the Script in DI.
Okay, next step. Have you assigned the result of the EXEC to a variable and printed it? It should say "copy complete ", since that is what you echo in the script.
Here is a snippet of our standard execute block. It will be a bit different from yours, since we are Linux, but close.
$N_Dir_Base_Glob = '/home/scripts/projectname/';
# Run the script and raise an exception if error is returned.
$I_Exec_Reslt = exec($N_Dir_Base_Glob || 'ScriptName.sh', '', 8);
print($I_Exec_Reslt);
$I_Retr_Code = substr($I_Exec_Reslt, 1, 7);
if ($I_Retr_Code != ' 0')
begin
raise_exception(substr($I_Exec_Reslt, 9, 1020));
end
Sorry, Sherry, I am out of options for you on this one. I would open a ticket with support or see if anyone else here who is on Windows can chime in with some ideas.
I may be entirely wrong here, but I thought it was not possible for a service to map drives, the net use command when run in the job via the service is unlikely to work. As I say, I could be wrong.
Can you make it a permanently mapped drive for that user and see if it makes any odds?