...
Code Block |
---|
@ECHO OFF
set argc=0
for %%x in (%*) do Set /A argc+=1
if %argc% == 0 (
echo no param
)
if %argc% == 1 (
echo param count = 1 "param=%1"
)
if %argc% == 2 (
echo param count = 2, "param=%1 %2"
) else (
echo param count = %argc%, "param=%*"
)
if "%1"=="apple" (
echo "param1 is apple"
goto end
) else {
echo "param1 is not apple"
goto end
} |
기타
echo 로 new line 출력
echo hello\nworld 로는 개행 문자가 출력 안 되고 다음처럼 echo. 으로 출력해야 함
Code Block |
---|
|
echo hello
echo.
echo world |
shell 의 if -f 처럼 batch 에서 file 의 존재 여부 확인
Code Block |
---|
if exist {insert file name here} (
rem file exists
) else (
rem file doesn't exist
) |
FOR 구문
...
Code Block |
---|
FOR /D %dirs in (*) do move "%var"\*.png ..\images |
기타
echo 로 new line 출력
echo hello\nworld 로는 개행 문자가 출력 안 되고 다음처럼 echo. 으로 출력해야 함
Code Block |
---|
|
echo hello
echo.
echo world |
shell 의 if -f 처럼 batch 에서 file 의 존재 여부 확인
Code Block |
---|
if exist {insert file name here} (
rem file exists
) else (
rem file doesn't exist
) |
Ref
...