File Exchange

image thumbnail

Get user home directory

version 1.0.0.0 (446 Bytes) by Sven Probst
get the user's home directory platform independent

7 Downloads

Updated 10 Aug 2007

No License

GETUSERDIR returns the user home directory using the registry on windows systems and using Java on non windows systems as a string

COLLABORATION:
As I am not familiar with non windows operating systems please give me information about incompatibilities - I rely on JAVA in this function

Comments and Ratings (9)

Yona

Yona (view profile)

very useful

David Young

David

David (view profile)

David

David (view profile)

thanks!

Eric

Eric (view profile)

Martin O'Reilly

Nice bit of code - just what I was looking for.

@ andy a: getenv('USERPROFILE') gets the root of your Windows profile. By default your "My Documents" folder will be directly under this root. Fowever, getenv('USERPROFILE') will not get your "My Documents" folder if you have changed it from the default (e.g. to another partition to separate data and operating system files).

andy a

Why not just this

if ispc; userdir= getenv('USERPROFILE');
else; userdir= getenv('HOME');
end

Javier Lopez

Nice!

MATLAB Release Compatibility
Created with R2006b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor