Batch abstractions…

I really HATE static scripts – and most of administrators use them. Static script means that paths, server names etc. are hardcoded to these scripts.


I am using quite simple method to workaround.


First method is using variable for current directory. This is extremely usefull for network scripts. The implementation is quite simple, you just need to include this two lines in your script and it will create variable Path.CurrentDirectory.


Set Path.CurrentDirectory=%~dp0


Set Path.CurrentDirectory=%Path.CurrentDirectory:~0,-1%


 


As you can see, its really easy.


I will talk about second method tomorrow – it is really useful for centralizing .ini files in your environment.


EDIT: Repaired typo… Thx BG for comment.

One thought on “Batch abstractions…”

Leave a Reply

Your email address will not be published. Required fields are marked *