Copy text file from one PC (XP OS) to another PC ( Vista OS) Using Dos Copy command

  • 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,

  • It is not the problem with Vista. The SQL Server Service account or SQL Server agent proxy account do not have access to the destination system. Is your SQL Serevr user is a member of sysadmin fixed group? If yes, xp_cmdshell is running under the security context of SQL Server Service account and in that case, you will have to grant permission to the specified account on the destination system(Vista). If you are not a member of sysadmin fixed group, then xp_cmdshell is running under the security context of the SQL Server agent proxy account.

    ..

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply