How to get pass username.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SuddenG
Posts: 1
Joined: 06 May 2009 09:45

How to get pass username.

#1 Post by SuddenG » 06 May 2009 09:50

Hi there guys,

I'm currently trying you use this line of code which works fine:
"%SystemRoot%\explorer.exe "C:\Program Files\Steam\Steamapps"

But after \steamapps there is a username which differs from computer to computer. I need to get past that in-order to open up another file.

Could you tell me how to make it open all usernames or %Username% or something.

Thanks.

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 07 May 2009 19:44

UNTESTED

Code: Select all

for /f "usebackq tokens=*" %%a in (`dir /ad /b "C:\Program Files\Steam\Steamapps"`) do (
   "%SystemRoot%\explorer.exe" "C:\Program Files\Steam\Steamapps\%%a\yourfile.txt"
)

Post Reply