Start a *.bat file - procedure
n.topalov
Member Posts: 26
Hi all, I know that there a lot of topics about similar kind of issues but I did no find a solution to myself.
So my problem is the following: I want to start an outside *.bat file which opens a cmd screen and start a procedure that takes about 6-7 sec. So when I start this file from Navision using SHELL - it actually run the file but didn't wait it to finish with the procedure and close the cmd screen immediately and nothing actually happen.
I tried several ways of starting SHELL (full path, short path), use a SLEEP after the SHELL but no success.
Please can you help me with this issue.
P.S. I am using SQL database with Navision 5.01 client
Thank you!
So my problem is the following: I want to start an outside *.bat file which opens a cmd screen and start a procedure that takes about 6-7 sec. So when I start this file from Navision using SHELL - it actually run the file but didn't wait it to finish with the procedure and close the cmd screen immediately and nothing actually happen.
I tried several ways of starting SHELL (full path, short path), use a SLEEP after the SHELL but no success.
Please can you help me with this issue.
P.S. I am using SQL database with Navision 5.01 client
Thank you!
0
Comments
-
Give this one a try: http://www.mibuso.com/forum/viewtopic.php?t=12417.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks for the reply but still do not get the wanted result.
I tried every type of the showing the screen but still as soon as press the button( from where I start DosShell) the screen appear for a second and then dissapear with nothing done.0 -
What happens when you run the bat file directly? Does DOS shell disappear immediately again or this problem emerges only when running from Navision?
Have you tried running another bat file from Navision?
You can also try adding a Pause command to the last line of the bat file. This way it will wait until you press a key to finish the process.Ufuk Asci
Pargesoft0 -
Thank you all. I just found the solution.
Yes when I ran the bat file it all goes well but when I start it from Navision it don't do anything.
But this paused that you tell me to put let me find the reason for the problem. It was in the bat file. It starts another .exe and the problem was that in the directory of the .exe in the bat file a 'cd' was missing and it couln't find it, and when I start it from Navisoion there was a problem. Nevermind.
Thank you0 -
If you use the "Run" methode of an automation variable of type 'Windows Script Host Object Model'.WshShell you can hide the command prompt window and make it wait untill the command has been executed.0
-
yeah I can know made a lit bit more userfriendly - hide the window, and use the return value to show status to the user.
Thanks0 -
The following code might be useful...
Function is called RunShellFunction(pCommandLine Text 1024) Code inside function is; IF STRPOS ( ApplicationManagement.ApplicationVersion , '3.70' ) <> 0 THEN SHELL ( pCommandLine ) ELSE BEGIN CREATE(WSH); WSH.Run(pCommandLine); CLEAR(WSH); END;
WSH is an Automation variable of type 'Windows Script Host Object Model'.WshShell
The RUN method allows you to change parameters for WindowStyle and WaitOnReturn.0 -
Hi All,
I am trying to run a batch file from MSD NAV using 'Windows Script Host Object Model'.WshShell (based on Kirki's function)variable but in vain.
The command is as follows
RetournValueAsInteger := DosShell('C:\abc.bat',1,TRUE);
Please help me to resolve the problem.
Regards,
AniThanks & Regards,
Aniruddha0 -
Do you get an error message?
Why are you not calling Run or Exec?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