I'm not getting success with this command
DECLARE @cmd sysname, @var sysname
SET @var = 'Hello world'
SET @cmd = 'echo ' + @var + ' > C:\var_out.txt'
EXEC master..xp_cmdshell @cmd
Already tried several examples, but it did not work. The command runs but the file simply does not create
What account is your SQL Server running under? Maybe it doesn't have enough privileges. If this is true, you can use sp_xp_cmdshell_proxy_account instead.
However, I believe you are trying to find the file on your machine instead of server. And what you are doing is storing the file to the server. Try to do it on the local SQL Server.