Forum Home
Press F1
 
Thread ID: 99138 2009-04-21 14:25:00 DOS Help harryd (14836) Press F1
Post ID Timestamp Content User
766893 2009-04-21 14:25:00 Hi All,

Scenario : I am required to develop a batch file that will zip files in a folder then transfer this across a network to another computer. The destination computer is password protected. After successfully transferring the file, I am then required to unzip the file. I have been able to achieve the zipping and unzipping aspect, however, as I am not too familiar with dos I am a bit in the dark as to how to achieve the transfer across the network.

Can anyone provide any assistance? Any help will be greatly appreciated.

Harry
harryd (14836)
766894 2009-04-21 14:29:00 Isn't it just the copy or xcopy command with your selection of switches?

copy C:\folder.zip \\Computername\path

Blam
Blam (54)
766895 2009-04-21 14:47:00 Thanks how do i get around the logon authentication though? harryd (14836)
766896 2009-04-21 15:24:00 I don't think you can logon to windows using cmd..

Why exactly are you trying to do this?

I reckon there's probably an easier alternative to this

Blam
Blam (54)
766897 2009-04-21 19:36:00 My guess is it's part of a course he/she is doing gary67 (56)
766898 2009-04-21 20:37:00 Thanks how do i get around the logon authentication though?

Well... how is the batch file being run? If it's been run within a current Windows session by a user and that user has file/share permissions for destination then there won't be a prompt for usersname/password as Windows will use the currently logged in users credentials to authenticate to the destination.

If the user doesn't have access they will be prompted to authenticate.

I am not sure but you could enter the username and password into the batch file... 1 line for each entry making sure there is a carriage return at then end of eachline for the username and password. This may aid with the authentication process.

Of course none of the above would apply if you were copying from one DOS box to another. There won't be any prompt for user authentication.

Hope that helps.
chiefnz (545)
766899 2009-04-21 21:05:00 Is there any particular reason for the zipping & unzipping? Because if it's to speed up the transfer, I don't think you're achieving anything - the zipped data from the remote folder will be re-transferred to the machine running the unzip script & re-sent to the remote in uncompressed form. So you end up transferring the compressed data twice & the uncompressed data once.

Anyway, regarding authentication, if you need to authenticate, take a look at the NET USE command (try NET HELP USE for details). You can do something like this:

<zip files>
net use /user:myname \\remote\share mysecretpassword
<copy zip to \\remote\share\folder & unzip>
net use \\remote\share /delete

That last line should "forget" the connection & authentication used (I think) so that the remote share doesn't become accessible for any other programs.
MushHead (10626)
1