I have two PC, One of them running on XP OS and another running on Vista OS.
Now I want to copy one text file from one PC (XP OS) to another PC (Vista OS) using dos Copy command.
PC running on Vista OS has Username: Admin and Password: Admin.
How can I pass Username and Password in Copy command?
Also I want to do this copy task using “xp_cmdshell” of MS SQL Server 2005. For that I use following code:
DECLARE @copycmd varchar ( 255)
PRINT 'Copy Start'
SET @copycmd = 'copy "f:\temp\test.txt" "\\server04\E\"'
PRINT @copycmd
EXECUTE master.. xp_cmdshell @copycmd
PRINT 'Copy End'
This code is works if both PC running on XP OS. But it gives “Logon failure: unknown user name or bad password.” Message when I tried this code on XP machine as source and Vista machine as Destination.
So,
How can I pass Username and Password in Copy command?
How can I copy text file from XP machine (source) to Vista machine (Destination) using SQL Scripts?
Is there any alternate way to getting copy task from MS SQL Server 2005? Please help me.
Thanks.