I want the program to process an arbitrary number of command-line arguments, but I'm unsure how to implement a for loop to go through multiple shift commands. Also, the program shouldn't close the command prompt window when it ends.
Here is what I have so far:
@echo off
if "%1"=="" goto skip
if "%1"=="-ti" time /t
if "%1"=="-da" date /t
if "%1"=="-c" cls
if "%1"=="-ip" ipconfig
if "%1"=="-d" dir
if "%1"=="-p" path
if "%1"=="-v" ver
if "%1"=="-t" type
if "%1"=="-m" md
exit /b
:skip
echo No arguments!
I'd like to have the following command-line arguments run properly:
C:\>batchfile –d –ti –da –ip –v
C:\>batchfile
C:\>batchfile –d –m CSC3323 –d
C:\>batchfile –d –t batchfile.bat –m CSC3323 –d