Page 1 of 1

get current directory problem

Posted: Thu Mar 17, 2022 4:43 pm
by alaphate
just one line code
---------
showmessage dir$("@")

copy the compiled showcd.exe to c:\windows\

run in cmd line:
>d:
d:\>showcd
message box result: d:\
but when run showcd with param, e.g.
d:\>showcd hello
result is c:\windows

problem is how to get exact current dir when running with cmd param?
thanks

Re: get current directory problem

Posted: Tue Mar 29, 2022 2:25 pm
by amksoft
You are right, if you use a command$ string values then the behaviour of the DIR$() changes.
I tried a few things, but no result.

Re: get current directory problem

Posted: Sat Jun 11, 2022 11:14 am
by Marco
I think the problem is you 'r running a program from another directory, in cmd first set the current directory to d with the dos command
cd d:\
you probleby run d:\showcd hello from the current dir c:\windows.

Re: get current directory problem

Posted: Thu Nov 16, 2023 7:24 pm
by Nico18n
Hi Marco,
I tried it too (I just joined this forum so hello to everyone) and I think you're right.
Cheers