xp cmdshell - copy-item using xp_cmdshell in SQL Server -


i'm trying send "copy-item" command using xp_cmdshell move item encrypt earlier in sproc. in sproc create .bat file, executed scheduled task, encryption.

i've tried using same method execute copy-item command, basic exec xp_cmdshell command , neither working. idea why work exec gpg, not when try exec copy-item command?

here's i've tried:

set @cmd = 'copy-file c:\missioncontroldocs\'+@docfolder+@rawfilenamewoext+'.txt.gpg y:\aep-ohio>> ' + @batchfilename) exec master..xp_cmdshell @cmd, no_output 

and selecting command batch file, calling task (which runs on server):

select @cmd = rtrim('echo copy-file c:\missioncontroldocs\'+@docfolder+@rawfilenamewoext+'.txt.gpg y:\aep-ohio>> ' + @batchfilename) exec master..xp_cmdshell @cmd, no_output        

copy-file works when run directly in powershell application on server - no matter directory i'm in.

your thoughts appreciated.

found answer, in 2 parts.

first, using copy-item (which powershell, not cmdshell).

second, able add copy line .bat file, adding start /wait previous line copy line didn't execute until previous command completed.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -