Senin, 23 Januari 2017

cmdkey /add:IP /user:administrator /pass:123
net use h: \\IP\NamaFolder \persistent:yes

 Make all future connections persistent (auto-reconnect at login)
 NET USE /Persistent:Yes
or 
 NET USE /P:Yes
CMDKEYPerintah cmdkey digunakan untuk menampilkan , membuat, dan menghapus user dan password disimpan
 run batch
Batch File

How To Create A Windows Batch File To Map Multiple Drives At Once

11
winlogo.jpgMapping a drive to a share on a remote computer can be a big time saver when you need to access files and folders remotely. UsingWindows Explorer, you can easily map the drive to the share on a remote computer when needed.
But what if you need to map multiple drives at once, or you want to always map the drive when you logon to your computer?
The best solution is to create a batch file that you can click on, when you need to map the drives, or copy it to your Windows user account Startup folder so the drives are mapped automatically during logon.
To map drives using a batch file, we'll need to use the net use command. At it's simplest form, the command looks like this:
net use [devicename | *] [\\computername\sharename
where:
devicename = the dive letter for the map drive
computername = is the computeer wher the share exists
sharename = is the name of the share
So to create a batch file that will map a drive to different computers that are sharing folders, we'll use the following commands:
net use W: \\computer1\MP3 
net use X: \\computer2\Photos
Note: you can asssign any drive letter you want, as long as it is not in use by your computer (for example A or drives).

What About Authentication?
Using the commands above to map drives, assumes that the account you are logged on as, exists on the remote computer where the shared folder is located, or if you are at work, is part of a Windows Domain.
If you need to authenticate when mapping the drive, we'll need to use an account that exists on the remote computer or in a Windows Domain, and add it onto the net use command as shown below:
net use [devicename | *] [\\computername\sharename password  /USER:username
Therefore the command will look like this when used in a batch file:
net use W: \\computer1\MP3 mypassword /USER:mary
net use X: \\computer2\Photos mypassword /USER:bob
If an error occurs (unknown user name), you will need to use the /USER switch with thedomainname option as follows:
net use W: \\computer1\MP3 mypassword /USER:mydomain\mary
If the remote computer is not part of a Domain, and is part of a Workgroup, then substitute the Domain for the name of the remote computer (where the user account resides).
net use W: \\computer1\MP3 mypassword /USER:computer1\mary

Creating The Batch File
Ok, now that we know how to use the net use command, let's create the batch file.
  • First, open up Notepad or your favorite text editor.
  • Next, copy the commands as shown below and paste them into the file. Don't forget to modify the net usecommand with the drive letter you want to use, the name of the Computer and share you want to map a drive to, and password and account name (if needed).
ECHO Begin Mapping Drivesnet use W: \\computer1\MP3 mypassword /USER:mary 
net use X: \\computer2\Photos myrealpassword /USER:bob 

exit
  • Then save the file with any name and a .bat extension (make sure it's NOT saved using .txt as the file type extension), to a location where you can easily access it (such as your Desktop).
  • When you need to map the drive(s), just double click on it.
  • http://onunqisa.blogspot.co.id/2012_12_01_archive.html 
  • http://blog.guardrex.com/

0 komentar:

Posting Komentar