Мне нужно написать консольное приложение, которое возвращает код возврата, который может быть захвачен через xp_cmdshell.XP_CMDSHELL Как записать возвращаемое значение?
Я начал с C# код следующим образом,
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;
}
}
The XP_cmdhsell Я использую некоторый код, который я нашел
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' и как проверить его значение. –