web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Run Windows Batch File Form NAV 2013 R2

(0) ShareShare
ReportReport
Posted on by

Hi All,

Can you please suggest me a way to run the Windows Batch File from a codeunit in NAV 2013 R2.

As Shell function is discontinued. is there any alternative solution for that.

Thanks in advance

Praveen.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at

    You can try with latest

    'Windows Script Host Object Model'.WshShell automation

    http://www.mibuso.com/forum/viewtopic.php?f=23&t=41930&start=0

  • Verified answer
    Rajasekhar@MS Profile Picture
    5,569 on at

    Hi Praveen

    refer the below to execute external programs from NAV

    community.dynamics.com/.../executing-external-programs.aspx

    Regards

    Rajasekhar.Y

  • Verified answer
    mmv Profile Picture
    11,471 on at

    Hi,

    WshShell of the "Windows Scripting Host" Automation can be used.

    Eg:

    Variable : WSHShell as Automation 'Windows Script Host Object Model'.WshShell

    IF ISCLEAR(WSHShell) THEN

        CREATE(WSHShell,FALSE,TRUE);

     WSHShell.SendKeys('^+I');

    Best Regards,

    MMV

  • Community Member Profile Picture
    on at

    You can use the SHELL function, with a return value. Navision will start the batch routine and wait until it's finished, if you call the SHELL function like this:

    retvalue := SHELL('c:\temp\runme.bat');

    <small>[ 26-05-2002, 09:22: Message edited by: ]</small>

  • Community Member Profile Picture
    on at

    Thanks to all of you,

    My main reason to run this batch file to upload files to FTP server. With the help IGOR PCHELNIKOV i am able to upload the file directly from NAV to FTP server.

    Name DataType Subtype Length

    FTPRequest DotNet System.Net.FtpWebRequest.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    FTPResponse DotNet System.Net.FtpWebResponse.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    Credentials DotNet System.Net.NetworkCredential.'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    This can be done with NAV existing variables.

    Thanks alot for the support.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans