Windows Bat File Potpourri

Purpose:

The purpose of this article is to display a set of commonly used Windows Bat Scripts

Check if a folder exists and create if it doesn't
if not exist "C:\Temp\InstallationLogs\" mkdir C:\Temp\InstallationLogs
Iterate through a .csv file
for /f "delims=," %%a in (Computers.csv) do (
Run a .exe from a share on each computer using psexec, Store results to a text file. Location for psexec from microsoft
C:\Temp\psexec.exe \\%%a -h -c \\ServerName\Share\HelloWorld.exe >> C:\Temp\InstallationLogs\%%a_InstallResults.txt)
Create temp Drive Letter mapped to your UNC root location and essentialy Change Directory to that location.
pushd \\servername\share
Remove the temp drive and return to orginal Directory
popd