# DOS command to read user path



## mgrove99 (Jan 18, 2005)

I am trying to create a batch file that will read the current user's path, maybe from the registry, and use this path to extract a file. I am trying to unzip a file to their documents & settings\<user>\my documents\... folder but need their user info to complete the path.

Any suggestions?


----------



## ChuckE (Aug 30, 2004)

In a DOS window enter the command "set" and see if any of the variables there are set to something you can use.


----------



## mgrove99 (Jan 18, 2005)

I can read a registry key but am not sure how to use this info in a set command so I can use the path name later.


----------



## angel (Dec 2, 1998)

Try:
%USERPROFILE%


----------



## ChuckE (Aug 30, 2004)

Why read a registry key if there is already a set value you can use.

As *angel* said you may be able to use %USERPROFILE%
as in:
unzip xyz.zip "%userprofile%\my documents"

(The above "unzip" command is not a command that exists in DOS without you getting such a program on your system. I only used it here as an example. Your command line may differ.)


----------



## mgrove99 (Jan 18, 2005)

That was the ticket, Thank you so much. How would I find more info on these types of command usages?


----------



## ChuckE (Aug 30, 2004)

Just type *help* in a DOS window, for a list of various commands.

For any one command (for example "blahblah") just type *help blahblah*

OR, most commands also have the */?* parameter.
So you could possibly type *blahblah /?*


----------



## mgrove99 (Jan 18, 2005)

I know about the DOS commands, but I do not know about the values %% available. Do you know where I might find more info on these?


----------



## angel (Dec 2, 1998)

When you did a "set", you should have seen numerous available variables. Just add the % before and after the name. You can also create your own and set them to whatever you like.
Another place to see them/edit them/add/delete, etc is to go to Environment Variables (available from System Properties).


----------



## mgrove99 (Jan 18, 2005)

I see that the keywords I needed to do a google search by were ENVIRONMENT VARIABLES. This gave me some good info on the variables available.

http://www.vlaurie.com/computers2/Articles/environment.htm

Thank you so much for pointing me in the right direction.


----------



## teruzzi (Jan 29, 2005)

Hello try with %USERNAME% or directly (better) with HOMEPATH=\Documents and Settings\mauri (%HOMEPATH%) and HOMEDRIVE=C: (%HOMEDRIVE%). This are suggest to change in many installation (like roaming profile).

Ciao
Maurizio


----------

