Unable to execute the batch file using Wise
Updated: 21 May 2010 | 15 comments
This issue has been solved. See solution.
Hi,
We are trying to execute a set of batch files using Wise Script.
We are able execute the very first batch file after none of the batchs are getting executed.
When we tried to capture the error it returns code 9009 which means its not able to find the batch file.
Even though batch file is present @ the specified location.
We can create and delete the batch from that location.
If we try executing the same batch via Windows after setting up the debugging point in Wise; it gets executed succcessfully.
Any pointers will be appreciated.
Thanks,
Onkar
discussion Filed Under:
Comments
Insufficient information
The most likely reason for the failures is that you are not supplying the FULL path for every file or operation you are trying to execute.
You CANNOT assume that the current working directory in Windows happens to be set to the location where the batch files are installed.
If this does not fix the issue, then you need to give us the full details of what is in your batch files and how you are calling them
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Hi EdT, We are providing the
Hi EdT,
We are providing the full path of the batch file for execution.
We are executing on Windows Server 2003 OS.
Following is the command used for execution of batch
item: Execute Program
Pathname=%TEMP_BAT%\Connect.bat
Flags=00001010
end
This batch executes the SQL which contains system stored proc to attach the database files to an instance.
Thanks,
Onkar
Not a reliable way to run a batch file
Execute Program should run CMD.EXE - do not assume that windows will always run a BAT file correctly as a BAT file is not an executable
Instead, try the following parameters in your Execute Program command:
Executable=%SYS%\cmd.exe
Command Line= /c %TEMP_BAT%\Connect.bat
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Why don't you simply run the
Why don't you simply run the SQL files using SQLCMD o OSQL?
Thanks a lot EdT. U Rock Dude
Thanks a lot EdT. U Rock Dude
Batch execution issue again
Hi,
I am using the following command to execute the batch file in Wise.
item: Execute Program
Pathname=%SYS%\cmd.exe
Command Line=/c %TEMP_BAT%\Connect.bat
Flags=00001010
end
It was working last week but stopped working all of a sudden and is behaving as if the batch does not exist @ mentioned location.
Can some one point wt else I could be missing the suggestion mentioned above has been incorporated.
Thanks a lot
You may have to look into the
You may have to look into the variable path (%TEMP_BAT%) for connect.bat. Do you see the batch file?
A simple display message would help you to track it down..
I checked the %TEMP_BAT%
I checked the %TEMP_BAT% variable is assigned the value Wise system variable %TEMP%.
Batch file is getting created at that location; I can execute the explicitly from Windows and it work fine but when i use execute statement from Wise Script; it seems that is it not able to find the batch file.
Try with a double quotoe
Try with a double quotes"%TEMP_BAT%\Connect.bat"
Tried but still no luck :-(
Tried but still no luck :-(
can you put down the error
can you put down the error screen for us
Problem is that it does not
Problem is that it does not throws any error at all.
I am trying to give it a hardcoded path and check whether it works or not.
Add some debug code
Add to your wisescript something like:
If File Exists "%TEMP_BAT%\Connect.bat"
Execute Program blah blah blah
Else
Display Message "File not Found"
End Block
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
I tried the suggestion.It is
I tried the suggestion.It is able to locate the file
Error code returned is 9009. I googled and it says 9009 means file is not found.
I am amused ; dn't know whether the issue is with Wise or Windows.
I am using Windows Server 2003. Could that be an issue?
Contents fo batch file are following:
OSQL -SPUNITP84562D\INSTANCE -USA -P"Antarctica" -i"C:\DOCUME~1\PRASHA~1\LOCALS~1\Temp\Connect.sql" -o"C:\DOCUME~1\PRASHA~1\LOCALS~1\Temp\Connect_db.txt"
echo %ERRORLEVEL% > "C:\DOCUME~1\PRASHA~1\LOCALS~1\Temp\Output.txt"
Input SQL file contents:
EXEC sp_attach_single_file_db @dbname = 'Meagain',
@physname = N'C:\Program Files\Microsoft SQL Server\Meagain.MDF';
GO
Path to OSQL
Try including the full path to OSQL.EXE
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Would you like to reply?
Login or Register to post your comment.