pdurbha
asked on
Passing username and password as arguments in a DOS copy command
Hi,
I am trying to copy a file on to a remote server using the DOS Copy command as below...but it errors out
with a logon failure message.
C:\>copy Centricity_Extract_EPI_1.t xt \\gbi-test\temp
Logon failure: unknown user name or bad password.
0 file(s) copied.
I have two questions:
1. How can I pass the username and password as arguments in the Copy command?
2. Can I embed the command in a .bat file and execute it as part of my build script.?
Thanks!
I am trying to copy a file on to a remote server using the DOS Copy command as below...but it errors out
with a logon failure message.
C:\>copy Centricity_Extract_EPI_1.t
Logon failure: unknown user name or bad password.
0 file(s) copied.
I have two questions:
1. How can I pass the username and password as arguments in the Copy command?
2. Can I embed the command in a .bat file and execute it as part of my build script.?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am able to map the shared folder on the remote server by running the command
C:\>NET USE X: \\gbi-test\temp /USER:GEMEDAMERICA\Adminis trator Gbi123Test123
The command completed successfully.
but when I try to copy the file over into X: it says access is denied.
C:\>copy Centricity_Extract_EPI_1.t xt X:
Access is denied.
0 file(s) copied.
What am I doing wrong here?
Thanks
C:\>NET USE X: \\gbi-test\temp /USER:GEMEDAMERICA\Adminis
The command completed successfully.
but when I try to copy the file over into X: it says access is denied.
C:\>copy Centricity_Extract_EPI_1.t
Access is denied.
0 file(s) copied.
What am I doing wrong here?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great..it works fine..
My other problem is I need to create a batch file .. I have tried to embed these two commands in a bat file as below: I am not sure if this is the right way of creating a bat file ..Any thoughts?
Thanks
@echo off
echo Mapping drive on remote server to local drive on build machine...
dir C:\>NET USE X: \\gbi-test\temp /USER:GEMEDAMERICA\Adminis trator Gbi123Test123
echo Mapping completed...
echo copying file into temp..
dir C:\>copy Centricity_Extract_EPI_1.t xt X:
echo copying completed...
My other problem is I need to create a batch file .. I have tried to embed these two commands in a bat file as below: I am not sure if this is the right way of creating a bat file ..Any thoughts?
Thanks
@echo off
echo Mapping drive on remote server to local drive on build machine...
dir C:\>NET USE X: \\gbi-test\temp /USER:GEMEDAMERICA\Adminis
echo Mapping completed...
echo copying file into temp..
dir C:\>copy Centricity_Extract_EPI_1.t
echo copying completed...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@echo off
echo Mapping drive on remote server to local drive on build machine...
NET USE X: \\gbi-test\temp /USER:GEMEDAMERICA\Adminis
echo Mapping completed...
echo copying file into temp..
copy Centricity_Extract_EPI_1.t
net use X: \\gbi-test\temp /DELETE
echo copying completed...
as shmoid told no need for a dir C: nad you can remove the share after you have copied by using net use X: \\gbi-test\temp /DELETE
let me know if you have any trouble
ASKER
ok..here's what i did:
In my batch file, I have this:
I get the following error message, when I double-click the batch file
Mapping drive on remote server to local drive on build machine...
'C:\' is not recognized as an internal or external command,
operable program or batch file.
Mapping completed...
copying file into temp..
'C:\' is not recognized as an internal or external command,
operable program or batch file.
copying completed...
Press any key to continue . . .
When I run the command:
C:\>NET USE X: \\gbi-test\temp /DELETE
A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.
C:\>NET HELPMSG 3510
A command was used with conflicting switches.
What should I do next?..Please advise as I haven't worked with batch files before.
Thanks
In my batch file, I have this:
I get the following error message, when I double-click the batch file
Mapping drive on remote server to local drive on build machine...
'C:\' is not recognized as an internal or external command,
operable program or batch file.
Mapping completed...
copying file into temp..
'C:\' is not recognized as an internal or external command,
operable program or batch file.
copying completed...
Press any key to continue . . .
When I run the command:
C:\>NET USE X: \\gbi-test\temp /DELETE
A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.
C:\>NET HELPMSG 3510
A command was used with conflicting switches.
What should I do next?..Please advise as I haven't worked with batch files before.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Actually, I got the bat file to work..so that issue is resolved.
so, the only issue is this:
C:\>NET USE X: \\gbi-test\temp /DELETE
A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.
I will post the points right after this..
Thanks
so, the only issue is this:
C:\>NET USE X: \\gbi-test\temp /DELETE
A command was used with conflicting switches.
More help is available by typing NET HELPMSG 3510.
I will post the points right after this..
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys u were great!
I am trying to copy a whole directory (instead of one file) using the DOS copy command to X: but it won't do it..
I have looked into xcopy also but that didn't work..any final thoughts?
Thanks
I am trying to copy a whole directory (instead of one file) using the DOS copy command to X: but it won't do it..
I have looked into xcopy also but that didn't work..any final thoughts?
Thanks
glad it worked
i think the xcopy command needs a /s
something like
xcopy *.*/s x:
i think the xcopy command needs a /s
something like
xcopy *.*/s x:
ASKER
I wanted to split the points between u guys..but i fouled up..sorry about that
no problem...
if you want to split you can always get help from the moderators
if you want to split you can always get help from the moderators
there is a button that says request attention in the question.. click it and ask for help there
https://www.experts-exchange.com/questions/22064921/copy-command-asks-for-username-password.html