Hi, I'm currently writing my first batch file for deploying an asp.net solution. I've been Googling a bit for a general error handling approach and can't find anything really useful.
Basically if any thing goes wrong I want to stop and print out what went wrong.
Can anyone give me any pointers?
Thanks in advance!
-
You need to read about ERRORLEVEL
From Shay Erlichmen -
Other than ERRORLEVEL, batch files have no error handling. You'd want to look at a more powerful scripting language. I've been moving code to PowerShell.
The ability to easily use .Net assemblies and methods was one of the major reasons I started with PowerShell. The improved error handling was another. The fact that Microsoft is now requiring all of its server programs (Exchange, SQL Server etc) to be PowerShell drivable was pure icing on the cake.
Right now, it looks like any time invested in learning and using PowerShell will be time well spent.
bplus : Yeah, I wish I had done it using power shell, have a felling hacking a batch script is not time well spent..From Brad Bruce
0 comments:
Post a Comment