Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

CMD - Open an User Account in Different Drive


  • Please log in to reply
11 replies to this topic

#1 Beings

Beings

  • Members
  • 63 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Gold Coast, Australia
  • Local time:06:06 AM

Posted 28 April 2015 - 06:58 PM

Hello.

 

I want to know how I could open an Windows 7 account through CMD on D Drive. D:\

 

The problem is, the user could be anything (user account will be unknown) so I just can't simply put my own in. 

 

I know the command "%ALLUSERSPROFILE%" but will not work.

 

Windows 7 is installed on C:\ Drive. 

 

The accounts that are installed, their directory are:

 

cd D:\<username>\

cd D:\<username>\Desktop

 

etc

 

Thanks,

 

Beings


Edited by Beings, 28 April 2015 - 07:01 PM.


BC AdBot (Login to Remove)

 


m

#2 JohnC_21

JohnC_21

  • Members
  • 21,596 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:06 PM

Posted 28 April 2015 - 07:36 PM

You can determine the users on the computer by doing the following. At an elevated command prompt type

 

net user <enter>

 

To get to the user account you want type the following at the command prompt

 

cd D:\  

cd users

cd  <username>

 

You could also access the accounts by booting a small linux distro like Puppy Linux.



#3 Beings

Beings
  • Topic Starter

  • Members
  • 63 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Gold Coast, Australia
  • Local time:06:06 AM

Posted 28 April 2015 - 08:40 PM

You can determine the users on the computer by doing the following. At an elevated command prompt type

 

net user <enter>

 

To get to the user account you want type the following at the command prompt

 

cd D:\  

cd users

cd  <username>

 

You could also access the accounts by booting a small linux distro like Puppy Linux.

 

 

 

No, I mean it will automatically detect the username. Like the "%ALLUSERSPROFILE%", it will detect the name itself so you don't need to find it out manually. I want this to be an automatic tool which you do not need to find out the username manually. 



#4 JohnC_21

JohnC_21

  • Members
  • 21,596 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:06 PM

Posted 28 April 2015 - 09:06 PM

I don't have any experience with it but this seems like somthing that can be done using a Powershell script or batch file. Hopefully somebody else on the forum has some experience with writing the script or batch file.



#5 Beings

Beings
  • Topic Starter

  • Members
  • 63 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Gold Coast, Australia
  • Local time:06:06 AM

Posted 28 April 2015 - 09:11 PM

I don't have any experience with it but this seems like somthing that can be done using a Powershell script or batch file. Hopefully somebody else on the forum has some experience with writing the script or batch file.

 

No problems man, thanks for your help. 



#6 JohnC_21

JohnC_21

  • Members
  • 21,596 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:06 PM

Posted 28 April 2015 - 09:19 PM

I did some searching, Try the following. I do not know if this is what you need. Type CMD at the command promt > Right Click run as Administrator

 

Type Powershell at the prompt

 

At the powershell prompt type the following

Get-ChildItem -Path D:\users -Recurse | Out-File c:\test.txt

This will create the text file test.txt on the root of C: of all files in directories and sub-directories of all users on D:


Edited by JohnC_21, 28 April 2015 - 09:19 PM.


#7 Beings

Beings
  • Topic Starter

  • Members
  • 63 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Gold Coast, Australia
  • Local time:06:06 AM

Posted 28 April 2015 - 09:30 PM

I did some searching, Try the following. I do not know if this is what you need. Type CMD at the command promt > Right Click run as Administrator

 

Type Powershell at the prompt

 

At the powershell prompt type the following

Get-ChildItem -Path D:\users -Recurse | Out-File c:\test.txt

This will create the text file test.txt on the root of C: of all files in directories and sub-directories of all users on D:

 

Hmm. I tried the script and it seems it has an error. 

 

 

Get-ChildItem : Cannot find path 'D:\users' because it does not exist.

At line:1 char:14
+ Get-ChildItem <<<<  -Path D:\users -Recurse | Out-File c:\test.txt
    + CategoryInfo          : ObjectNotFound: (D:\users:String) [Get-ChildItem
   ], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCh
   ildItemCommand

 

I got the notepad in C:\ Drive but it was blank. I will also look into this script.

 

Thanks man



#8 JohnC_21

JohnC_21

  • Members
  • 21,596 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:06 PM

Posted 28 April 2015 - 09:46 PM

It worked for me though my users directory was on C:\ and not on D:. I am assuming the computer has a Users directory on D:\, correct? I will have to investigate more tomorrow.

#9 Beings

Beings
  • Topic Starter

  • Members
  • 63 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Gold Coast, Australia
  • Local time:06:06 AM

Posted 28 April 2015 - 09:48 PM

It worked for me though my users directory was on C:\ and not on D:. I am assuming the computer has a Users directory on D:\, correct? I will have to investigate more tomorrow.

 

Yes that is correct. Also, that's fine. 

 

You have been a huge help!



#10 JohnC_21

JohnC_21

  • Members
  • 21,596 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:06 PM

Posted 29 April 2015 - 07:51 AM

Does the command work when -path is removed? I did this on C: and it still worked. Is D: a partition or a separate disk?

Get-ChildItem D:\users -Recurse | Out-File c:\test.txt

Depending on the size of Users, it will take a bit to get another prompt.



#11 Beings

Beings
  • Topic Starter

  • Members
  • 63 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Gold Coast, Australia
  • Local time:06:06 AM

Posted 30 April 2015 - 06:19 PM

I get this message.

 

PS C:\Windows\System32\WindowsPowerShell\v1.0> Get-ChildItem D:\users -Recurse |
 Out-File c:\test.txt
Get-ChildItem : Cannot find path 'D:\users' because it does not exist.
At line:1 char:14
+ Get-ChildItem <<<<  D:\users -Recurse | Out-File c:\test.txt
    + CategoryInfo          : ObjectNotFound: (D:\users:String) [Get-ChildItem
   ], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetCh
   ildItemCommand
 
Both C:\ and D:\ are on one disk. 


#12 JohnC_21

JohnC_21

  • Members
  • 21,596 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:03:06 PM

Posted 30 April 2015 - 09:22 PM

I am not sure why it says D: users does not exist. The Users directory on D: is not hidden is it? If you do the following command 

 

CD D:\

dir users

 

Does Users show in the prompt or does it say it does not exist?

 

If you start Powershell and input this command does it still say Users does not exist?

 

Set-Location -Path D:\users

 

If the Set-Location command above does not give an error use the command in my previous post.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users