Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- SETLOCAL ENABLEDELAYEDEXPANSION
- ::: Passing of Command / special Characters via unexpanded Variables. Only works for Shared Environments.
- Set "Astring= A complex star c:\* -> A complex star"
- CALL ParamTest.bat 3 4 2 1 2 3 4 5 3 2 1 2 3 4 5 6 5 4 3 2 1 2 3 4 5 6 7 6 5 4 3 2 1 Astring
- ECHO HOME
- Pause
- exit
- *******************************************
- ParamTest.bat
- *******************************************
- @ECHO OFF
- SETLOCAL EnableDelayedExpansion
- REM :: Used to define the Array Index values and Range
- set _I=0
- REM :: The Core piece in recieving Large numbers of Parameters.
- REM :: Processes all Parameters. Tested to over 2500 Parameters.
- FOR %%a in (%*) DO (
- CALL Set /a _I+=1
- CALL Set "arg[!_I!]=%%a"
- IF DEFINED %%a (
- CALL SET "arg[!_I!]=!%%a!"
- )
- )
- REM :: Loops through the Array to display Parameter Values.
- FOR /L %%a in (1,1,!_I!) DO (
- ECHO !arg[%%a]!
- )
- echo %_I% Arguements recieved.
- Pause
- GOTO :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement