COMMAND$ changes current directory to app path
Posted: Fri Jul 27, 2012 1:44 pm
I started a new thread because I positively identified the problem - it looks like a bug with the COMMAND$ cmd line argument function. When you specify a cmd line arg, it CHANGES the current directory to the compiled app`s install directory.
Someone please do me a favor and compile this and let me know if your FNX Basic does this too, or if its just me, maybe bad env variable or something? (Thx to Admin for telling me about the DIR$("@") FN).
-----
`CMDBROKE.BAS
PRINT "Command$=`";Command$;"`"
PRINT "Current Directory=";DIR$("@")
WHILE INKEY$="":WEND
-----
C:FNXBASIC>fnxcompiler cmdbroke.bas
C:FNXBASIC>copy cmdbroke.exe c:utils
1 file(s) copied.
NOTE: c:utils is in my DOS path.
C:FNXBASIC>cmdbroke
cd c:windows
C:WINDOWS>cmdbroke
OUTPUT SCREEN:
Command$=``
Current Directory=C:WINDOWS
C:WINDOWS>cmdbroke anyarghere
OUTPUT SCREEN:
Command$=` anyarghere`
Current Directory=C:UTILS
????WHY DID IT CHANGE MY PATH TO THE APP PATH???? >:(
(This is bad because if I run my app from C:my documents, I want it to stay in C:my documents so it can open the right file etc.)
SOLUTIONS ?:
I don`t know, possibly I can write a batch file that captures the current path to a tmp file (like: @CD>CURRPATH.TXT), then batch file runs my compiled app, and compile app gets the current path from CURRPATH.TXT. But this is so un-elegant I really don`t want to do this!
Also, I will try the 2 previous versions of FNX Basic to see if they act the same way.
Someone please do me a favor and compile this and let me know if your FNX Basic does this too, or if its just me, maybe bad env variable or something? (Thx to Admin for telling me about the DIR$("@") FN).
-----
`CMDBROKE.BAS
PRINT "Command$=`";Command$;"`"
PRINT "Current Directory=";DIR$("@")
WHILE INKEY$="":WEND
-----
C:FNXBASIC>fnxcompiler cmdbroke.bas
C:FNXBASIC>copy cmdbroke.exe c:utils
1 file(s) copied.
NOTE: c:utils is in my DOS path.
C:FNXBASIC>cmdbroke
cd c:windows
C:WINDOWS>cmdbroke
OUTPUT SCREEN:
Command$=``
Current Directory=C:WINDOWS
C:WINDOWS>cmdbroke anyarghere
OUTPUT SCREEN:
Command$=` anyarghere`
Current Directory=C:UTILS
????WHY DID IT CHANGE MY PATH TO THE APP PATH???? >:(
(This is bad because if I run my app from C:my documents, I want it to stay in C:my documents so it can open the right file etc.)
SOLUTIONS ?:
I don`t know, possibly I can write a batch file that captures the current path to a tmp file (like: @CD>CURRPATH.TXT), then batch file runs my compiled app, and compile app gets the current path from CURRPATH.TXT. But this is so un-elegant I really don`t want to do this!
Also, I will try the 2 previous versions of FNX Basic to see if they act the same way.