xp_cmdshell을 통해 캡처 할 수있는 반환 코드를 반환하는 콘솔 응용 프로그램을 작성해야합니다. XP_CMDSHELL 반환 값을 캡처하는 방법은 무엇입니까?
class Program
{
static int Main(string[] args)
{
//make sure the correct number of arguments are being passed.
if (args.Length !=5)
{
Console.WriteLine("not thr right number of args. \nUsage SFTPUploadFile <host> <port> <username> <password> <localFilePath>");
return 1;
}
return 0;
}
}
XP_cmdhsell
내가 몇 가지 코드를 사용하고 다음과 같이 내가 C# 코드로 시작, 나는
declare @rc int
create table #output (id int identity(1,1), output nvarchar(255) null)
insert #output (output) exec @rc = master..xp_cmdshell 'd:\FILENAME PARA1 PARA2 PARA3 PARA4 PARA5'
select * from #output where output is not null order by id
drop table #output
을 발견하지만 난 내 xp_cmdshell을 실행할 때, 난 그냥 널 얻을. 1이나 0을 받아야하지 않나요?
감사
아마도 'xp_cmdshell'에 대한 호출과 그 값을 확인하는 방법을 추가해야합니다. –