forked from Batch-Man/BatCenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetDim.Bat
47 lines (38 loc) · 1.34 KB
/
GetDim.Bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@Echo off
SetLocal EnabledelayedExpansion
REM GetDim Function ver.1.0 by kvc, Enhanced by Sounak;
REM It Returns the current Dimensions of cmd console, which is calling this Function.
REM Syntax: Call GetDim [Rows] [Columns]
Rem Visit www.thebateam.org for more extensions / plug-ins like this.... :]
Rem #TheBATeam
REM Checking things...
If /i "%~1" == "" (goto :help)
If /i "%~1" == "/?" (goto :help)
If /i "%~1" == "-h" (goto :help)
If /i "%~1" == "help" (goto :help)
If /i "%~1" == "-help" (goto :help)
If /i "%~1" == "ver" (echo.1.0&&goto :eof)
If /i "%~2" == "" (goto :help)
REM Main Code of function...
Set _Parameter=1
For /f "Skip=3 tokens=2" %%A in ('mode con') do (Set "_!_Parameter!=%%A"&&Set /A _Parameter+=1)
Endlocal && Set "%~1=%_1%" && Set "%~2=%_2%"
Goto :EOF
:help
Echo.
Echo. This function Simply Returns the current Dimensions of cmd console,
Echo. in Two variables provided.
echo.
echo. Syntax: Call GetDim [Rows] [Columns]
echo. Syntax: call GetDim [help ^| /^? ^| -h ^| -help]
echo. Syntax: call GetDim ver
echo.
echo. Where:-
Echo. Rows = The Variable to save 'No. of Rows [Y]'
Echo. Columns = The Variable to save 'No. of Columns [X]'
echo. Help = Shows this screen.
echo. ver = Version of the function.
echo.
echo. Visit www.thebateam.org for more...
echo. #Kvc with #TheBATeam
goto :eof