Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1943
  • Last Modified:

call an excutable file from navision using "SHEEL" function

Hi All,

I am trying from navision to call an executable file, i read about it and i am found that "SHEEl" function can solve the problem. i am trying to call a file of extension .txt and the "SHEEl" function work fine, the code is as follows:
/*
//The path and name of the command
param:='C:\New Text Document.txt';
//the name of the executable file
ExecName:='C:\windows\notepad.exe';
ret:=SHELL(ExecName,param);
*/
but the problem occur when i am trying to call an executable file generated by the C# language because i don't know the path and name of the command of  the "ExecName" in .net.

Please can any body send me the path and name of the command of  the "ExecName" in .net.

In case there is another method to call an exceutable file generated by .net please send me the solution.

0
MKItani
Asked:
MKItani
  • 2
1 Solution
 
MKItaniAuthor Commented:
sorry, i have adjusted the question

Hi All,

I am trying from navision to call an executable file, i read about it and i am found that "SHEEl" function can solve the problem. i am trying to call a file of extension .txt and the "SHEEl" function work fine, the code is as follows:
/*
//The path and name of the command
ExecName:='C:\windows\notepad.exe';
//the name of the executable file
param:='C:\New Text Document.txt';
ret:=SHELL(ExecName,param);
*/
but the problem occur when i am trying to call an executable file generated by the C# language because i don't know the path and name of the command of  the "ExecName" in .net.

Please can any body send me the path and name of the command of  the "ExecName" in .net.

In case there is another method to call an exceutable file generated by .net please send me the solution.
0
 
sshah254Commented:
You should know the executable filename from your C# project.

Check in the project folder, there will be a directory that contains the "binary / executable" files.  In that folder will be your .exe file.

Ss
0
 
MKItaniAuthor Commented:
Please read carefully the question i know the name of the executable file generated by .net is "test.exe" but what i want to run the "SHEEl" method is two parameter as mentioned is the question SHELL(ExecName,param);
the param is "C;\Test.exe";
the missing parameter is ExecName????
the "ExecName" is the path and name of the command like "ExecName:='C:\windows\notepad.exe';" to run the text file.

0
 
adrianakersCommented:
I would be wary of running the SHELL function as it is no longer supported since Version 5 of NAV.

Instead I prefer to use the Windows Script Host Object Model automation.

I'd create an Automation variable, let's say called WSH of type 'Windows Script Host Object Model'.WshShell

Then my code would look like this...

pCommandLine := 'C:\Test.exe';
CREATE(WSH);
WSH.Run(pCommandLine);
CLEAR(WSH);

That should then work fine in the latest versions of NAV and the earlier versions.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now