Problem in Running CMD Shell from Navision

pradeepkmr478
Member Posts: 13
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
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
Pradeep Bhardwaj
0
Comments
-
Well Pradeep, what is ECHO? Is it an executable or simply a function inside the command processor?
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.aspxFrank Dickschat
FD Consulting0 -
Thanks Frank Dickschat, It's working ..........Regards
Pradeep Bhardwaj0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions