Hi,
I have sql code that uses the xp_cmdshell procedure to call and run a .bat file. I am passing a variable value to the .bat file from the sql code.
Now at the dos prompt if I type the following it works..
C:\event.bat %username%
This picks up the name of the user and passes it as a parameter to the event.bat file
But if I pass this value through xp_cmdshell..
EXEC master..xp_cmdshell 'C:\event.bat %username%'
it does not take the value of username but treats
%username% as the value to the parameter in the event.bat file
Why is this? Can anybody help me with this..or is there a way of going around it??
Thanks for all the help...
Lakshmi.
I have sql code that uses the xp_cmdshell procedure to call and run a .bat file. I am passing a variable value to the .bat file from the sql code.
Now at the dos prompt if I type the following it works..
C:\event.bat %username%
This picks up the name of the user and passes it as a parameter to the event.bat file
But if I pass this value through xp_cmdshell..
EXEC master..xp_cmdshell 'C:\event.bat %username%'
it does not take the value of username but treats
%username% as the value to the parameter in the event.bat file
Why is this? Can anybody help me with this..or is there a way of going around it??
Thanks for all the help...
Lakshmi.