-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeep.bat
More file actions
31 lines (24 loc) · 767 Bytes
/
keep.bat
File metadata and controls
31 lines (24 loc) · 767 Bytes
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
@echo off
rem
rem Save the first parameter in the saved variable
rem
set saved=%1
echo parameter zero (batch file commandc) is %0
echo first parameter is %1
rem
rem The shift command moves the %1 to %0 and %2 to %1, so that the
rem previous value is replaced
shift
echo new first parameter is %1
echo old first parameter is %0
rem
rem If we do another shift, the original %1 (now %0) gets lost.
rem Since we stored in the saved variable, we can recover the
rem value. With named (as opposed to numbered) variables, you
rem have to use a percent sign before and after the variable
rem name to get the value.
rem
shift
echo new first parameter is %1
echo original first parameter is %saved%
echo now parameter zero is %0