- NSIS Discussion
- Problem with ExecWait and osql.exe
Archive: Problem with ExecWait and osql.exe
blue_harvester
22nd May 2006 12:55 UTC
Problem with ExecWait and osql.exe
I'm trying to execute the following:
ExecWait '"osql.exe" -S SERVER -U USER
-P PASSWORD -n -i validate_osql.sql > validateOSQL.dat -b' $OUT
But this is not working. The $OUT variable is set to 1 after execution.
I have copied the exact command to a cmd window and it works fine. Also executing sqlplus commands works perfectly too.
Any ideas?
RobGrant
22nd May 2006 13:00 UTC
What doesn't work?
blue_harvester
22nd May 2006 13:11 UTC
Originally posted by RobGrant
What doesn't work?
Sorry, I should've been more specific. The actual execution of the osql.exe command doesn't work, ExecWait works fine. When I do the following it works fine:
ExecWait '"sqlplus.exe" USER/PASSWORD@DATABASE @validate_sqlplus.sql'
Thanks.
RobGrant
22nd May 2006 13:18 UTC
Are you using the split line in the actual code? If so, you want to put a \ at the end of the first line so it carries over properly.
blue_harvester
22nd May 2006 13:21 UTC
Originally posted by RobGrant
Are you using the split line in the actual code? If so, you want to put a \ at the end of the first line so it carries over properly.
No, the code is all on one line.
RobGrant
22nd May 2006 13:23 UTC
So what happens? Does the ExecWait DOS box appear? Does the call itself fail, or the osql program within it? Are you checking the exact commandline call, so that you can make sure it's not just a syntax error?
blue_harvester
22nd May 2006 13:55 UTC
Originally posted by RobGrant
So what happens? Does the ExecWait DOS box appear? Does the call itself fail, or the osql program within it? Are you checking the exact commandline call, so that you can make sure it's not just a syntax error?
The ExecWait DOS box appears for a split second (too short to see what the output is). Also to check the syntax, I have copied the command within the quotes and pasted it into a command window and this works perfectly! I'm really stumped as to what's going wrong.
RobGrant
22nd May 2006 15:01 UTC
Hm, I bet it's the output redirection that's the problem. Try without the "> validateOSQL.dat -b", see what happens.
blue_harvester
22nd May 2006 15:39 UTC
Originally posted by RobGrant
Hm, I bet it's the output redirection that's the problem. Try without the "> validateOSQL.dat -b", see what happens.
You're right Rob, got it to work. Using the -o option now with osql. Suppose I should've used that from the start!
Thanks again.
RobGrant
22nd May 2006 15:46 UTC
Hehe that's ok :) There is a way to get it to work with the > though, you just need to mess around with quotation marks to get it to work.
gustavo-serra
1st November 2007 14:58 UTC
I am having the same problem, but I do not use output redirection. As RobGrant, I paste the command in a DOS shell and it works as it should. What can I do?
The command is: 'FOR /F $\"tokens=1,*$\" %i IN ($\'at$\') DO IF %~nxj EQU limpabd.sh.bat at %i /DELETE'
It is a loop to remove specific agended tasks.
Thanks any help.
Anders
1st November 2007 15:04 UTC
try to prefix that command with: cmd.exe /c
you really should use nsExec or one of the other "Dos" exec plugins
gustavo-serra
1st November 2007 16:46 UTC
Ok, I will download and use it at once. I will give a try to your tip, thanks very much! :-D