get current directory problem

In this category you can exchange your programming questions and solutions.
Post Reply
alaphate
Posts: 9
Joined: Sun Feb 13, 2022 6:10 am

get current directory problem

Post: # 98374Post alaphate
Thu Mar 17, 2022 4:43 pm

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

amksoft
Posts: 4
Joined: Tue Mar 29, 2022 1:38 pm

Re: get current directory problem

Post: # 98377Post amksoft
Tue Mar 29, 2022 2:25 pm

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.

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

Re: get current directory problem

Post: # 98383Post Marco
Sat Jun 11, 2022 11:14 am

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.

Nico18n
Posts: 2
Joined: Thu Nov 16, 2023 6:33 pm

Re: get current directory problem

Post: # 98388Post Nico18n
Thu Nov 16, 2023 7:24 pm

Hi Marco,
I tried it too (I just joined this forum so hello to everyone) and I think you're right.
Cheers

Post Reply