Get drive name on Win 10?

Just starting out? Need help? Post your questions and find answers here.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Get drive name on Win 10?

Post by Dude »

I've been using the following code perfectly for years with Windows XP and 7, but I just found out that it doesn't return a disk drive volume name for Windows 10 (based on a screenshot I saw of my app, not from personal experience). Can someone with Windows 10 please confirm? Thank you.

Code: Select all

d$="C:\"

drivename$=Space(999)
driveserial$=Space(999)
drivefs$=Space(999)

GetVolumeInformation_(d$,@drivename$,990,@serial,0,0,@drivefs$,990)

s$=Hex(serial,#PB_Long) : driveserial$=Left(s$,4)+"-"+Right(s$,4)

Debug drivename$ ; Shows empty string on Windows 10. :(
Debug driveserial$
Debug drivefs$
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

Confirmed.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Get drive name on Win 10?

Post by Dude »

Dammit. :cry: Thanks.
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

Use

Code: Select all

..
Last edited by Thunder93 on Tue Jul 19, 2016 12:00 pm, edited 1 time in total.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Get drive name on Win 10?

Post by Dude »

Thanks Thunder93! :D

[Edit] I seriously think I'll have to bite the bullet and upgrade to Win 10 before July 27. It'll make bug-testing easier too because a Win XP ISO is way smaller in size than Win 10, for VirtualBox. :)
Last edited by Dude on Tue Jul 19, 2016 12:00 pm, edited 1 time in total.
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

Nope didn't work. hmmmm
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Get drive name on Win 10?

Post by Dude »

Thunder93 wrote:Nope didn't work. hmmmm
Huh? Oh crap. I might start the Win 10 upgrade tonight then...
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

They work. Reason why it's blank, not everyone has their drives labelled so it becomes ' Local Disk (?:) ' in File Explorer. :)
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Get drive name on Win 10?

Post by Dude »

So my original code works too?
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

Yes.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Get drive name on Win 10?

Post by Dude »

Thunder93 wrote:Yes.
Again: Thanks Thunder93! :D

BTW, I tested it with an unlabelled drive and you're right. Thanks for helping me with this. :)
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

No problem. :)
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Get drive name on Win 10?

Post by Dude »

And thanks for saving me from upgrading to Windows 10. :twisted:
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Get drive name on Win 10?

Post by Thunder93 »

I don't know if I actually done you good service there... :twisted: :lol:
Dude wrote:And thanks for saving me from upgrading to Windows 10. :twisted:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Get drive name on Win 10?

Post by davido »

@Dude,
I wanted to find the drive name on Windows 10. Unfortunately I hadn't got a clue. :)
Luckily I managed to find this thread.
Thank you very much for posting the question and also thanks to Thunder93 for the tip. :D
DE AA EB
Post Reply