Hi all,
I'm trying to execute bat in Nav 2013 in a page action.
I follow the article of @Saurav Dhyani (https://community.dynamics.com/nav/b/sauravdhyanimicrosoftdynamicsnav/archive/2015/08/30/nav-2013-amp-later-how-to-run-a-batch-file-from-nav).
This link explains perfect step by step how to do it. But when i launch the action page the client freeze and not responding.
In my case for do test i do it a more simple bat file, only set a echo instruccion:
@echo off
echo Bat Test.
pause
And the code in C/AL:
Command := 'C:\CAC\test.bat'
ExecuteBat := ExecuteBat.ProcessStartInfo('cmd','c/ "' + Command + '"');
ExecuteBat.RedirectStandardError := TRUE; // In Case of Error the Error Should be Redirected.
ExecuteBat.RedirectStandardOutput := TRUE; // In Case of Sucess the Error Should be Redirected.
ExecuteBat.UseShellExecute := FALSE;
ExecuteBat.CreateNoWindow := TRUE; // In case we want to see the window set it to False.
Process := Process.Process; // Constructor
Process.StartInfo(ExecuteBat);
Process.Start;
ErrorMsg := Process.StandardError.ReadToEnd(); // Check Error Exist or Not
IF ErrorMsg <> '' THEN
ERROR('%1',ErrorMsg)
ELSE BEGIN
Result := Process.StandardOutput.ReadToEnd();// Display the Query in the Batch File.
MESSAGE('%1',Result);
END;
I'm trying to change some option but always frezee the client freeze.
Any idea ??
Thanks!
Regards
*This post is locked for comments