Hi.. Good Morning.
I am working on Navision Version 2009 Classic. Running a small commad using automation "Windows Script Host Object Model'.WshShell" as WHSPradeep.
Using Code below :-
CMDReturnCode:=-1;
IF ISCLEAR(WHSPradeep) THEN CREATE(WHSPradeep);
Var1Temp:=0;
Var2Temp:=1;
CMDReturnCode := WHSPradeep.Run('Echo Pradeep Bhardwaj >> C:\text.txt',Var1Temp,Var2Temp);
CLEAR(WHSPradeep);
But i am getting error message:-
Microsoft Dynamics NAV Classic
This message is for C/AL programmers:
An exception was raised in method Run. The OLE control or Automation server has returned error (HRESULT) -2147352567.
The component did not provide the exception description.
OK
Please help ....
Thanks in advance
Regards
Pradeep Bhardwaj
0
Comments
What happens when you just execute "echo bla" in Wndows? What I mean is:
In XP use Start, Execute and enter "echo bla" or in Win 7 just open the StartMenu and enter "Echo bla" into the search field. Do not use the command processor! This is exactly what you have programmed and of course an error occurs.
What you really want is to start the command processor and have it execute the function echo.
WSH.run('cmd /c', 'echo...
Take a look here:
http://techblog.byllemos.com/2008/04/execution-of-batch-jobs-and-other-programs-from-navision/
or here:
http://dynamicsuser.net/forums/p/11946/58460.aspx
FD Consulting
Pradeep Bhardwaj