mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 4:13 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: DOS Access from Navision
PostPosted: Fri Jul 13, 2007 2:22 pm 
Offline

Joined: Wed Jun 13, 2007 8:47 am
Posts: 15
Location: Mumbai
Country: India (in)
Is it Possible to run one command in DOS from navision?
regards
febin

_________________
Febin Chiramel
Mumbai
India


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 13, 2007 2:39 pm 
Offline

Joined: Sat Jun 17, 2006 9:01 am
Posts: 58
Location: Uden
Country: Netherlands (nl)
See the SHELL command in the C/AL manual


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 7:55 am 
Offline

Joined: Wed Jun 13, 2007 8:47 am
Posts: 15
Location: Mumbai
Country: India (in)
how to pass one caommand into dos by using shell


any body can give some examples or related links

_________________
Febin Chiramel
Mumbai
India


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 8:03 am 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7504
Location: Milan
Country: Italy (it)
[Topic moved from Navision DOS forum to Navision forum]

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 8:14 am 
Offline

Joined: Mon Mar 08, 2004 2:42 pm
Posts: 3255
Location: Hannover
Country: Germany (de)
use shell() or WSH.

Which command do you will send to DOS :?:

_________________
Do you make it right, it works too!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 8:38 am 
Offline

Joined: Wed Jun 13, 2007 8:47 am
Posts: 15
Location: Mumbai
Country: India (in)
I want to simply run Command prompt and pass DIR command.

Thanks

_________________
Febin Chiramel
Mumbai
India


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 10:05 am 
Offline

Joined: Wed Dec 19, 2001 8:01 am
Posts: 144
Location: Netherlands
Country: Netherlands (nl)
Something like SHELL(ENVIRON('comspec'), ' /c dir *.* > file.txt')


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 11:16 am 
Offline

Joined: Wed Jun 13, 2007 8:47 am
Posts: 15
Location: Mumbai
Country: India (in)
Its not working yaar

_________________
Febin Chiramel
Mumbai
India


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 17, 2007 12:32 pm 
Offline

Joined: Wed Dec 19, 2001 8:01 am
Posts: 144
Location: Netherlands
Country: Netherlands (nl)
What's not working? do you see any messages. Replace /c with /k to see what happens...


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sat Jul 21, 2007 11:11 am 
Offline

Joined: Wed Jun 13, 2007 8:47 am
Posts: 15
Location: Mumbai
Country: India (in)
ya now it is working ..
But its default path i'm seeing is licence file path......
where this path is storing ....
Do you have any Idea...

_________________
Febin Chiramel
Mumbai
India


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 21, 2007 6:06 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 11, 2004 9:05 pm
Posts: 4858
Location: Los Angeles, CA
Country: United States (us)
Please be more specific on what you need to accomplish by pass DOS command. You mentioned in the previous post that you only need to pass DIR command, but now, you want something different? :?:

_________________
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Sun Jul 22, 2007 9:42 am 
Offline

Joined: Wed Dec 19, 2001 8:01 am
Posts: 144
Location: Netherlands
Country: Netherlands (nl)
chiramel: first take a look how the command prompt works. If you want to write the contents of a directory to a file, you need to redirect it. Hence the '> file.txt. ' If you want to redirect it to a certain file in a certain directory, use '> <driveletter><pathname><filename>. For example, '> c:\test\output.txt' would redirect the output of the dircommand to the file output.txt, in the directory test, on de C: drive.

If you do not want the output to be written in a file, simply omit the '> file.txt' part.

If you want a specific directory to be listed, you need to change the dir command, like dir <driveletter><pathname><filename>, like dir c:\program files\*.* would list all the files in the directory program files on the c: drive.

If you got everything working, change the /k back to /c, so it will continue automatically.

If you want to test things first, start the commandprompt, and try the commands there, without the 'SHELL(ENVIRON('comspec'), ' /c' part


One more example: To get a listing of the complete windows directory of the computer, from navision, and get it in the file 'navoutput.txt' in the temporary directory, the command would be:

SHELL(ENVIRON('comspec'), ' /c dir %Windir%\*.* /s > %temp%\navoutput.txt')

Or, in more readable form (but less flexible)

SHELL(ENVIRON('comspec'), ' /c dir c:\windows\*.* /s > c:\docume~1\chiramel\locals~1\temp\navoutput.txt')


All in all, you need to take a look into the DIR command of the commandprompt. So start the commandprompt and type dir /?


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Sun Jul 22, 2007 10:01 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jul 31, 2003 12:00 pm
Posts: 639
Location: Nürnberg
Country: Germany (de)
Hi!

I would also recommend to use the "Windows Script Host" instead of SHELL, as it provides more smart features; e.g. like hiding the DOS-Box and avoiding the "Trusted-Confirmation-Dialog" (since NAV 4.00).

Here an example:
Code: Select all
{Variables:
WSH_Shell     Automation 'Windows Script Host Object Model'.WshShell
Command       Text255
ExitCode      Integer
WindowStyle   Variant
WaitOnReturn  Variant}

Command := STRSUBSTNO('%1 /c dir *.* > file.txt', ENVIRON('COMSPEC'));  // set DOS-Command here

WindowStyle := 0;

{ Window Styles:
0 Hide the window and activate another window.
1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first time.
2 Activate & minimize.
3 Activate & maximize.
4 Restore. The active window remains active.
5 Activate & Restore.
6 Minimize & activate the next top-level window in the Z order.
7 Minimize. The active window remains active.
8 Display the window in its current state. The active window remains active.
9 Restore & Activate. Specify this flag when restoring a minimized window.
10 Sets the show-state based on the state of the program that started the application.}

WaitOnReturn := TRUE;  // modal run, receive ExitCode

IF ISCLEAR(WSH_Shell) THEN
  CREATE(WSH_Shell);
ExitCode := WSH_Shell.Run(Command, WindowStyle, WaitOnReturn);

MESSAGE('%1', ExitCode);   // 0 = OK; 1 := Error

_________________
Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool


Top
 Profile E-mail WWW  
 
 Post subject:
PostPosted: Mon Jul 23, 2007 7:54 am 
Offline
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7504
Location: Milan
Country: Italy (it)
http://www.mibuso.com/forum/viewtopic.php?t=12417 :whistle:


stryk wrote:
Hi!

I would also recommend to use the "Windows Script Host" instead of SHELL, as it provides more smart features; e.g. like hiding the DOS-Box and avoiding the "Trusted-Confirmation-Dialog" (since NAV 4.00).

Here an example:
Code: Select all
{Variables:
WSH_Shell     Automation 'Windows Script Host Object Model'.WshShell
Command       Text255
ExitCode      Integer
WindowStyle   Variant
WaitOnReturn  Variant}

Command := STRSUBSTNO('%1 /c dir *.* > file.txt', ENVIRON('COMSPEC'));  // set DOS-Command here

WindowStyle := 0;

{ Window Styles:
0 Hide the window and activate another window.
1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first time.
2 Activate & minimize.
3 Activate & maximize.
4 Restore. The active window remains active.
5 Activate & Restore.
6 Minimize & activate the next top-level window in the Z order.
7 Minimize. The active window remains active.
8 Display the window in its current state. The active window remains active.
9 Restore & Activate. Specify this flag when restoring a minimized window.
10 Sets the show-state based on the state of the program that started the application.}

WaitOnReturn := TRUE;  // modal run, receive ExitCode

IF ISCLEAR(WSH_Shell) THEN
  CREATE(WSH_Shell);
ExitCode := WSH_Shell.Run(Command, WindowStyle, WaitOnReturn);

MESSAGE('%1', ExitCode);   // 0 = OK; 1 := Error

_________________
Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 23, 2007 9:05 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jul 31, 2003 12:00 pm
Posts: 639
Location: Nürnberg
Country: Germany (de)
:lol:

_________________
Jörg A. Stryk (MVP - Dynamics NAV)
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: