# handling the path that Navision is running

**URL:** https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128
**Category:** Developers Forum
**Created:** [September 8, 2004, 1:25pm UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128 "2004-09-08T13:25:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alpay](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@alpay](https://www.dynamicsuser.net/u/alpay)
#### Post date: [September 8, 2004, 1:25pm UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128/1 "2004-09-08T13:25:32Z")

</div>

Hi All. How could I handle the path that Navision is running . I will copy a application that prints barcode in this path. And I want to use this path to run application. Regards.

---

<div class="post-metadata">

### Author: ![erictp](https://avatars.discourse-cdn.com/v4/letter/e/c4cdca/32.png) [@erictp](https://www.dynamicsuser.net/u/erictp)
#### Post date: [September 8, 2004, 2:57pm UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128/2 "2004-09-08T14:57:54Z")

</div>

If you meen the TempFilePath then it is: sPath := ENVIRON(‘TEMP’);

---

<div class="post-metadata">

### Author: ![alpay](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@alpay](https://www.dynamicsuser.net/u/alpay)
#### Post date: [September 8, 2004, 3:14pm UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128/3 "2004-09-08T15:14:43Z")

</div>

> quote:
> 
> * * *
> 
> _Originally posted by ErictP_  
> If you meen the TempFilePath then it is: sPath := ENVIRON(‘TEMP’);
> 
> * * *

No, I want to get path where Navision Client Installed. for my machine this is C:\Program Files\Microsoft Business Solutions-Navision\Client Regards

---

<div class="post-metadata">

### Author: ![JSoage](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@JSoage](https://www.dynamicsuser.net/u/JSoage)
#### Post date: [September 9, 2004, 1:40pm UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128/4 "2004-09-09T13:40:03Z")

</div>

Try this code `VAR i@1000000000 : Integer; TempFileName@1000000003 : Text[250]; FileWithNavDir@1000000001 : File; MsgText@1000000002 : Text[250]; BEGIN i := STRPOS(UPPERCASE(COMMANDLINE), 'FIN.EXE'); IF i = 0 THEN i := STRPOS(UPPERCASE(COMMANDLINE), 'FINSQL.EXE'); IF i = 0 THEN BEGIN TempFileName := 'C:\NAVDIR_TEST.TXT'; SHELL('CMD', '/c', 'ECHO %CD%>' + TempFileName); FileWithNavDir.TEXTMODE(TRUE); IF FileWithNavDir.OPEN(TempFileName) THEN BEGIN FileWithNavDir.READ(MsgText); FileWithNavDir.CLOSE; FILE.ERASE(TempFileName); END; END ELSE MsgText := COPYSTR(COMMANDLINE, 1, i - 1); MESSAGE('Navision Path in: %1', MsgText); END; `

---

<div class="post-metadata">

### Author: ![alpay](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@alpay](https://www.dynamicsuser.net/u/alpay)
#### Post date: [September 9, 2004, 2:16pm UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128/5 "2004-09-09T14:16:01Z")

</div>

Thanks a lot Jesus.

> quote:
> 
> * * *
> 
> _Originally posted by JSoage_  
> Try this code `VAR i@1000000000 : Integer; TempFileName@1000000003 : Text[250]; FileWithNavDir@1000000001 : File; MsgText@1000000002 : Text[250]; BEGIN i := STRPOS(UPPERCASE(COMMANDLINE), 'FIN.EXE'); IF i = 0 THEN i := STRPOS(UPPERCASE(COMMANDLINE), 'FINSQL.EXE'); IF i = 0 THEN BEGIN TempFileName := 'C:\NAVDIR_TEST.TXT'; SHELL('CMD', '/c', 'ECHO %CD%>' + TempFileName); FileWithNavDir.TEXTMODE(TRUE); IF FileWithNavDir.OPEN(TempFileName) THEN BEGIN FileWithNavDir.READ(MsgText); FileWithNavDir.CLOSE; FILE.ERASE(TempFileName); END; END ELSE MsgText := COPYSTR(COMMANDLINE, 1, i - 1); MESSAGE('Navision Path in: %1', MsgText); END; `
> 
> * * *

---

<div class="post-metadata">

### Author: ![anfinnur](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@anfinnur](https://www.dynamicsuser.net/u/anfinnur)
#### Post date: [September 10, 2004, 11:13am UTC](https://www.dynamicsuser.net/t/handling-the-path-that-navision-is-running/9128/6 "2004-09-10T11:13:37Z")

</div>

You could also call your Navision via a command-file like this: **@echo off d: cd \Navision set CurrentNavisionDir=%CD% start fin.exe id=D:\Navision\myUserId,database=D:\Navision\database.fdb** (…change drive-letter and/or directory according to your installation [:)]) Now you have created an environtment variable called “CurrentNavisionDir” - and in a Navision-object you can give a statement like “_txMyCurrentDir := ENVIRON(‘CurrentNavisionDir’);_” Voila!
