Skip to main content

[archive] How to get the defalut dirve letter?

  • June 13, 2008
  • 4 replies
  • 0 views

[Migrated content. Thread originally posted on 11 June 2008]

Hello,

I want to read the defalut drive letter?
I do get it now but using a long procedure, I wonder if a call exist to DLL to get it? can anyone want to help pls.?

Regards,

4 replies

[Migrated content. Thread originally posted on 11 June 2008]

Hello,

I want to read the defalut drive letter?
I do get it now but using a long procedure, I wonder if a call exist to DLL to get it? can anyone want to help pls.?

Regards,
I assume you mean current drive?

This would be GetCurrentDirectory from the Kernel32.dll

[Migrated content. Thread originally posted on 11 June 2008]

Hello,

I want to read the defalut drive letter?
I do get it now but using a long procedure, I wonder if a call exist to DLL to get it? can anyone want to help pls.?

Regards,
Thanks again, you're great.

Regards

[Migrated content. Thread originally posted on 11 June 2008]

Hello,

I want to read the defalut drive letter?
I do get it now but using a long procedure, I wonder if a call exist to DLL to get it? can anyone want to help pls.?

Regards,
I have used the C$CHDIR call using a empty string. That will return the current directory as well as the current drive
Example:

MOVE SPACES TO C-DIR
CALL "C$CHIDR" USING C-DIR
MOVE C-DIR(1:2) TO L-DRIVE

Of course this will only work if you are running your application from a local or a mapped drive.

Other ways would be: ACCEPT L-DRIVE FROM ENVIRONMENT "SYSTEMDRIVE"

or like the example above you can use the SYSTEMROOT environment as well,
Example:
ACCEPT SYS-ROOT FROM ENVIRONMENT "SYSTEMROOT"
MOVE SYS-ROOT(1:2) TO L-DRIVE

[Migrated content. Thread originally posted on 11 June 2008]

Hello,

I want to read the defalut drive letter?
I do get it now but using a long procedure, I wonder if a call exist to DLL to get it? can anyone want to help pls.?

Regards,
Thanks for the professional answers, and I'm really learning a lot from everyone here.
Ahmed, Belgium