Xcopy - Invalid drive specification error

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
gigaaks
Posts: 11
Joined: 28 Sep 2012 11:42

Xcopy - Invalid drive specification error

#1 Post by gigaaks » 02 Oct 2012 20:59

:cry: Xcopy command issue:

So far my findings are:

1. I’m on Server: 10.211.18.108
2. Change directory to Folder F:\CBTbuild
3. Script: xcopy_src_dest.bat

From Windows command prompt, when I run the script or xcopy command itself with 2 parameters ex:
xcopy_src_dest.bat \\10.211.18.115\c$\CBTBUILDS\cbt_05_07_02_004 cbt_05_07_02_004_test_test_test

(It runs fine)

or

xcopy /v /y /e /i /c /Z /h \\10.211.18.115\c$\CBTBUILDS\cbt_05_07_02_004 cbt_05_07_02_004_test_test_test

(It runs fine)

-------------------

Now Issue:
1. If I create a “Scheduler task” on this x.x.x.108 server and run the same script / command with the above params, I get the same error message that I’m getting in Jenkins (as shown below in RED).

2. On Jenkins as well, when I’m running the command using “remcom”, I’m getting the following for the above script. Remcom is able to call the remote server script successfully (thus the following user given output is displayed on Jenkins page) but xcopy command part fails. Wondering IF running the script/command from x.x.x.208 server’s command prompt is fine, then, why even Windows server’s own Scheduler task is having the same issue.

22:16:39 --------------------- xcopy src dest - batch -------------------- start
22:16:39 - Source loc : \\10.211.18.115\c$\CBTBUILDS\cbt_05_07_02_004
22:16:39 - Target loc : cbt_05_07_02_004_test_test_test
22:16:39 ------------------------------------------------------------
....
...
somewhere here the same above xcopy command runs (as shown above which is successful) resulting into the following error.
...
....
22:16:51 Invalid drive specification
22:16:51 0 File(s) copied

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Xcopy - Invalid drive specification error

#2 Post by foxidrive » 02 Oct 2012 23:30

Didn't I reply to you on this topic in another thread/?

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Xcopy - Invalid drive specification error

#3 Post by abc0502 » 03 Oct 2012 03:09

I'm sure that scheduled task won't change directory then run the batch,
are you putting the full location to the batch before adding the switches and the locations?

gigaaks
Posts: 11
Joined: 28 Sep 2012 11:42

Re: Xcopy - Invalid drive specification error

#4 Post by gigaaks » 03 Oct 2012 08:54

Yes.

Here's the solution.

Cause: Somehow When I'm using \\x.x.x.x\drive$\CBTBuilds as the first param, the command works when running from CMD prompt/ or through running .bat from CMD prompt --- BUT NOT, when doing the same exercise through Jenkins (using remcom - remote desktop cmd run utility from a different machine) or throught that server's own Windows task scheduler. great!!!!

Solution was that I had to map the source location.

i.e.

remcom.exe \\%db_server_ip% /user:domain\%domain_user_name% /pwd:%domain_user_password% NET USE T: \\%web_server%\%web_drive%$\CBTBUILDS %domain_user_password% /USER:domain\%domain_user_name%

remcom.exe \\%db_server_ip% /user:domain\%domain_user_name% /pwd:%domain_user_password% "F:\CBTBuild\xcopy_src_dest.bat" "T:\%curr_build_label%" F:\CBTBuild\cbt_05_07_02_004_test_test_test\

remcom.exe \\%db_server_ip% /user:domain\%domain_user_name% /pwd:%domain_user_password% NET USE T: /DELETE

gigaaks
Posts: 11
Joined: 28 Sep 2012 11:42

Re: Xcopy - Invalid drive specification error

#5 Post by gigaaks » 03 Oct 2012 09:41

abc0502 wrote:I'm sure that scheduled task won't change directory then run the batch,
are you putting the full location to the batch before adding the switches and the locations?


Yes, I was. Options I was using with Xcopy were: /i /v /y /e /h/ /c /Z and what not :) but issue was the copy from location (1st param to xcopy was a \\x.x.x.x\x$\xxx\xxx folder location and Xcopy somehow didn't like it so, i had to map this "copy from / source" location. See below.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Xcopy - Invalid drive specification error

#6 Post by Ed Dyreen » 05 Oct 2012 13:37

gigaaks wrote:Options I was using with Xcopy were: /i /v /y /e /h/ /c /Z and what not :) but issue was the copy from location (1st param to xcopy was a \\x.x.x.x\x$\xxx\xxx folder location and Xcopy somehow didn't like it so, i had to map this "copy from / source" location. See below.
The problem ( authentication failure ) is unrelated to xcopy ( Invalid drive specification ) because authentication failed.
As you figured already, one solution is to map ( requires authentication ) the remote location to a local drive.
Another is to run under an account that exists on both systems and has the required privileges.

gigaaks
Posts: 11
Joined: 28 Sep 2012 11:42

Re: Xcopy - Invalid drive specification error

#7 Post by gigaaks » 08 Oct 2012 09:37

Ed Dyreen wrote:
gigaaks wrote:Options I was using with Xcopy were: /i /v /y /e /h/ /c /Z and what not :) but issue was the copy from location (1st param to xcopy was a \\x.x.x.x\x$\xxx\xxx folder location and Xcopy somehow didn't like it so, i had to map this "copy from / source" location. See below.
The problem ( authentication failure ) is unrelated to xcopy ( Invalid drive specification ) because authentication failed.
As you figured already, one solution is to map ( requires authentication ) the remote location to a local drive.
Another is to run under an account that exists on both systems and has the required privileges.


Yep, did the same. Thank you.

Post Reply