21

I am trying to access a remote server on a different domain through its IP address. In run command I entered the following

\\XXX.XXX.XXX.XXX\C$\Program Files\

I get a pop up window asking for username and password. I enter it, and accessed the path. When I try accessing the folder again it do not ask for my password. But when I restart, it does give the popup again.

Is there a way to add my credentials?? Lets say my domain\username is MyDomain\RapsyTree. I tried the following:

cmdkey /generic:TERMSRV/YYY.YY.YYY.YYY /user:YourDomain\rapsalands /pass:secretPass

The credentials are getting added. But I am still getting the pop up for username and password.

Actually I am trying to xcopy some files on this server on different domain. But I need to do it with different credentials. I am using batch files. Any pointers will be of great help. Let me know if I am not clear. I am using Windows 7 Thanks!

4

3 に答える 3

22

ネットワークドライブをマップするだけです:

net use Z: \\XXX.XXX.XXX.XXX\C$ password /user:domain\username 

次回のログオン時にドライブを再接続する場合は、オプションを追加します/persistent:yes

于 2013-01-29T08:08:12.087 に答える
16

これを試すこともできます。ユーザー名とパスワードを引数として渡します。コピー後、マッピングを削除して切断します。

SET username=%1
SET password=%2
net use "\\xxx.xxx.xxx.xxx\Some Folder" %password% /user:domain\%username%
:copy
copy "\\xxx.xxx.xxx.xxx\Some Folder\New.txt" "D:\new.txt"
IF ERRORLEVEL 0 goto disconnect
goto end
:disconnect 
net use "\\xxx.xxx.xxx.xxx\Some Folder" /delete
goto end
:end
于 2013-01-29T11:21:50.927 に答える
5

IP を二重引用符で囲んでみてください。それは私のために働いた。

net use "\\xxx.xxx.xxx.xxx\Some Folder" password /user:domain\username

投稿してください:)

于 2013-01-29T09:22:21.287 に答える