Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Johnph
Posting Yak Master
103 Posts |
Posted - 2012-10-27 : 11:28:05
|
| I have a .vbs script that talks in a robot voice. It says "GOOD", I am writing a case when query that does some validating between two tables. If the validation is good then it will run the script that says "GOOD".My question is, is there a way I can run a .vbs script from a sql command? I was doing some research on this and xp_cmdshell may be able to. This is assuming my .vbs file is on 'C:\test\test.vbs' |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-10-27 : 14:39:47
|
| xp_cmdshell lets you run most anything that you can run from a command window. By default it is turned off. To turn it on, see here: http://msdn.microsoft.com/en-us/library/ms190693.aspxIt is turned off by default because it is a security risk. People very oftne set up proxy accounts to run xp_cmdshell - see here for details and examples: http://msdn.microsoft.com/en-us/library/ms175046.aspx |
 |
|
|
Johnph
Posting Yak Master
103 Posts |
Posted - 2012-10-27 : 16:01:25
|
| hmm I turned it on and tried:EXEC xp_cmdshell '"C:\test.bat"' and it doesn't seem to be working. the bat file looks like this:START /WAIT CScript "C:\test.vbs" and executes a .vbs script that talks, which looks like this:StrText=("Hello World")set ObjVoice = CreateObject("SAPI.SpVoice")ObjVoice.Speak StrText |
 |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-10-27 : 17:33:57
|
| If your program creates a window, you will not be able to see the window or interact with the window. The exe will be created and you will be able to see it in task manager. If it is waiting for user input the only way you will be able to kill it is through task manager. |
 |
|
|
Johnph
Posting Yak Master
103 Posts |
Posted - 2012-10-27 : 22:38:21
|
| Ok, the vbs script doesn't open any screens... can I execute that with xp_cmdshell or possibly something else? |
 |
|
|
|
|
|