NAV 2013 R2 - Shell is not working while calling from C/AL code but working fine with Command Prompt
Rati_kant_Jha
Member Posts: 1
Hi,
We are facing issue while connecting FTP client (using Core FTP application).
using the below code:
l_txtCommand := rec."FTP Client Path" +
' -site ' + rec."Site Name" +
' -s -O -d ' + rec."Sales Directory"+ '*.*'+
' -p ' + rec."Sales Local Dir" +' -delsrc'+
' -Log ' + rec."FTP Log File Path";
WshShell.Shell(l_txtCommand, WshExec.Hide, FALSE, 0);
defined the below variables:
WshShell : Microsoft.VisualBasic.Interaction.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
WshExec: Microsoft.VisualBasic.AppWinStyle.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
but if we type the above text with variable path on command prompt then it connects the FTP without any any problem.
Unable to figure out if any windows component is missing or any NAV component missing. It is happening from one particular application server, which was rebuild recently on Windows 2008 R2 standard. The above code is running on other servers but unable to run on single server which was rebuilt recently.
Please advice with your valuable comments.
Thanks
Rati Kant
We are facing issue while connecting FTP client (using Core FTP application).
using the below code:
l_txtCommand := rec."FTP Client Path" +
' -site ' + rec."Site Name" +
' -s -O -d ' + rec."Sales Directory"+ '*.*'+
' -p ' + rec."Sales Local Dir" +' -delsrc'+
' -Log ' + rec."FTP Log File Path";
WshShell.Shell(l_txtCommand, WshExec.Hide, FALSE, 0);
defined the below variables:
WshShell : Microsoft.VisualBasic.Interaction.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
WshExec: Microsoft.VisualBasic.AppWinStyle.'Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
but if we type the above text with variable path on command prompt then it connects the FTP without any any problem.
Unable to figure out if any windows component is missing or any NAV component missing. It is happening from one particular application server, which was rebuild recently on Windows 2008 R2 standard. The above code is running on other servers but unable to run on single server which was rebuilt recently.
Please advice with your valuable comments.
Thanks
Rati Kant
0
Answers
-
You can try this:
ProcInfo := ProcInfo.ProcessStartInfo;
ProcInfo.FileName := ExecName;
ProcInfo.Arguments := Parameters;
ProcInfo.UseShellExecute := FALSE;
ProcInfo.RedirectStandardOutput := TRUE;
ProcInfo.WindowStyle := 1; // Hidden
ProcInfo.CreateNoWindow := TRUE;
WShell:= WShell.Start(ProcInfo);
Where:
ExecName would be your rec."FTP Client Path"
In Parameters you must put the rest of the command
The dotNet vars are:
WShell DotNet System.Diagnostics.Process.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
ProcInfo DotNet System.Diagnostics.ProcessStartInfo.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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
