Skip to main content
6 events
when toggle format what by license comment
Mar 12, 2012 at 5:43 comment added piers7 ...or it's doing the equivilent of CreateProcess, but to do that you have to supply the exe and the arguments seperately, so then it'd be doing it's own cmd-line parsing just to split off the first bit (the process) and leave everything else as arguments. Come to think of it, maybe they use CommandLineToArgvW to do exactly that. But then it'd be up to the receiving process to expand environment parameters in it's arguments, which seems unlikely.
Mar 12, 2012 at 5:25 comment added piers7 ...unless SQL Agent has some special cases where it knows how to do a 'dir' and 'echo' and such like (ie forward anything that starts with a shell command to the shell directly). But that seems like a really brittle arrangement (unless there's an API to query to find all the candidates). So I'm still not convinced we have characterised the actual behaviour in a way that makes any sense.
Mar 12, 2012 at 5:22 comment added piers7 Really. I couldn't find any 'dir' in my path'. Nor any 'echo' either - these two are shell commands surely, not exe's/.coms in the filesystem somewhere. Which makes no sense at all. If they're not exes, to resolve them SQLAgent would have to take the command and pass it INTACT to the shell, at which point environment variable expansion should kick in.
Mar 9, 2012 at 18:37 comment added mrdenny For the reason that I said. The DLL that SQL Agent uses runs dir %programfiles%. The command is dir which is in the path, so the SQL Agent can find it easily enough. At that point it's within the shell and the OS expands %programfiles% to "c:\program files\". %programfiles%\some.exe on the otherhand is the actual executable which when the DLL tries to find it, fails because the DLL can't expand %programfiles% to anything as it doesn't understand variables.
Mar 8, 2012 at 7:42 comment added piers7 That's only half true. In some cases, environment variables do get expanded, for example if your job step is 'dir %programfiles%'. But '%programfiles%\some.exe' will fail. I'm not sure I can come up with an explanation for this that makes sense
Feb 20, 2012 at 1:16 history answered mrdenny CC BY-SA 3.0