»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 10-23-2003, 02:39 PM   #1 (permalink)
Registered User
 
Join Date: Oct 2003
Location: Ohio
Posts: 41
DrDave1958 is on a distinguished road
Using the "AT" command to run a batch file

I've created a batch file to copy some files from the hard drive to a network drive on a domain. The batch file works fine until I run it with the AT command (scheduler). I placed a pause in my batch file so I could catch any error messages and the error reads, "Invalid Drive Specification". I have permissions for this drive, which is proven by my success executing it manually. If I modify my batch file to copy from/to the local HD, and run it thru AT, it works fine. Syntax to follow.....

AT 12:30PM /interactive C:\Mybatch.bat

Batch file contains.........

Xcopy c:\Myfolder\*.* \\server\share\Myfolder\bkup /s
I've also tried....
Xcopy c:\Myfolder\*.* X:\Myfolder\bkup /s ....where X is the network drive letter. Anyone have any Ideas?

Thanks, Dave


NT 4.0 on a domain
P.S. I've also tried Winat

DrDave1958 is offline   Reply With Quote
Old 10-23-2003, 03:03 PM   #2 (permalink)
Registered User
 
meese's Avatar
 
Join Date: Jun 2003
Location: NJ
Posts: 1,096
meese is on a distinguished road
You can't copy to a "path". You need to map a drive to the path location.

You need to map a drive to \\server\share\Myfolder\bkup

then use this drive in the xcopy command like this:

xcopy c:\Myfolder\*.* M: /s

where M is the mapped drive.

You can do this on the fly like this:

NET USE M: \\YourServer\D$
c:
cd\
xcopy MyFolder M:\MyFolder\ /D /S /E /Y
NET USE M: /DELETE

This mapps the drive, copies the folder then removes the mapped drive.

Edit:

I just re-read your post and see that you tried to use a mapped drive. When I use xcopy I don't need to specify *.*, xcopy copies everything anyway.

Last edited by meese; 10-23-2003 at 04:44 PM.
meese is offline   Reply With Quote
Old 10-24-2003, 06:00 AM   #3 (permalink)
Registered User
 
Join Date: Oct 2003
Location: Ohio
Posts: 41
DrDave1958 is on a distinguished road
Thanks for the response Meese.

I guess the real question here is why does this work when I execute the batch file manually, but doesn't when the scheduler executes it?

-Dave-
DrDave1958 is offline   Reply With Quote
Old 10-24-2003, 09:07 AM   #4 (permalink)
Registered User
 
meese's Avatar
 
Join Date: Jun 2003
Location: NJ
Posts: 1,096
meese is on a distinguished road
That error message can be generated if the mapped drive is already in use. Is this line:

AT 12:30PM /interactive C:\Mybatch.bat

part of the batch file Mybatch.bat?

If you are trying to map the drive twice you will get that error. I was able to make it work on my domain.
meese is offline   Reply With Quote
Old 10-24-2003, 10:57 AM   #5 (permalink)
Registered User
 
Join Date: Oct 2003
Location: Ohio
Posts: 41
DrDave1958 is on a distinguished road
No.
AT 12:30PM /interactive C:\Mybatch.bat is enter manually at the command prompt. The file Mybatch.bat contains these two lines...

xcopy c:\abb\*.* \\servername\data\abb\bkup /d/s/e/v/c/z
pause

I'm not mapping the drive. It's automatically mapped when I login. BTW, I'm an administrator of the local machine and a wksadmin, site admin, & server operator of the domain (if that matters). Although now That I think about it, I logged in as a domain admin and it still didn't work. Any other ideas are greatly appreciated.


Thanks, Dave
Nt 4.0 on a NT 4.0 domain
DrDave1958 is offline   Reply With Quote
Old 10-24-2003, 11:24 AM   #6 (permalink)
Registered User
 
meese's Avatar
 
Join Date: Jun 2003
Location: NJ
Posts: 1,096
meese is on a distinguished road
Dave,

the xcopy command won't work when you use a relative path:

\\servername\data\abb\bkup

you need to create a mapped drive first:

NET USE X: \\servername\data

then this:

xcopy c:\abb X:\abb\bkup /d/s/e/v/c/z


Try this:

NET USE X: \\servername\data
xcopy c:\abb X:\abb\bkup /d/s/e/v/c/z
NET USE X: /DELETE


Now if you already create the mapped drive at logon you don't need to use the NET USE commands.

If you didn't have the proper permissions you would get other messages like "You cannot access the resource, check with your network admin" or something like that.

The error "Invalid Drive Specification" means it wants to do the command but throws a flag because it can't locate the destination. I believe its something basic you maybe over looking.
meese is offline   Reply With Quote
Old 10-24-2003, 12:00 PM   #7 (permalink)
bdj
Registered User
 
bdj's Avatar
 
Join Date: Oct 2001
Location: L.A. County
Posts: 320
bdj is on a distinguished road
How is the Batch job running? That is, does the batch job run with out you being logged on. If so, does the Batch job have sufficient access rights?

bdj
bdj is offline   Reply With Quote
Old 10-24-2003, 12:08 PM   #8 (permalink)
Registered User
 
Join Date: Oct 2003
Location: Ohio
Posts: 41
DrDave1958 is on a distinguished road
OK Meese, I know you 've been trying to beat this into my head and I haven't been getting it, but I'm seeing the light now.

Even tho the X: drive was already mapped by my login, that wasn't enough. I had to map a new drive letter (I chose L to the server, then delete it just like you explained. Here's what worked....

NET USE L: \\servername\data
xcopy c:\abb\*.* L:\abb\bkup /d/s/e/v/c/z
NET USE L: /DELETE

Thankyou.

My next problem is that it wants a username and password to map the drive. When I put it in manually, it works, so I'm now looking for syntax to put it in the batch file. Can you help?

Thanks, Dave
DrDave1958 is offline   Reply With Quote
Old 10-24-2003, 12:21 PM   #9 (permalink)
Registered User
 
meese's Avatar
 
Join Date: Jun 2003
Location: NJ
Posts: 1,096
meese is on a distinguished road
Dave,

You've made me learn somethings I never knew about.

First one was the AT command and now the second one is the RUNAS command.

Type RUNAS /? at the command prompt. It will show you the syntax (usage) for this command. With this command you can run something as an admin even if your logged on as a regular user. Toy around with that, and I'll do the same.

Now as for the first problem you had, trying to copy to X:. Are there any other users mapped to X: that have an open connection? This may be why you can't use X:. (Just a last minute thought)
meese is offline   Reply With Quote
Old 10-24-2003, 12:34 PM   #10 (permalink)
Registered User
 
Join Date: Oct 2003
Location: Ohio
Posts: 41
DrDave1958 is on a distinguished road
Nailed it!

NET USE L: \\servername\data /user:domain\username password

xcopy c:\abb\*.* L:\abb\bkup /d/s/e/v/c/z

NET USE L: /DELETE

I think the reason I can't use the X: drive as it is mapped by my login, is because the AT command uses the system account, which doesn't have rights to the network.

Meese, thanks so much for all your help!

-Dave-
DrDave1958 is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 01:17 AM.