I don't know if you can do that with .BAT files and what few tools Windows comes with, but you sure can with .js (JScript) or .vbs (VBScript) files. You are doing this under Windows, right? If so, then Windows can process .js and .vbs files just as well as .bat files by default. They are far more powerful.
And, if you happen to be targeting only Windows Server 2008, there's PowerShell which is even better (downloadable for other Windows versions).