「batファイル」引数のダブルコーテーションの文字列を利用するサンプル

2021年2月8日

書式
call:関数名 "引数1″ “引数2"
使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
@echo off
call:testFunc "AA01" "BB02" "CC03" "DD04"
echo run end
exit /b
'受ける引数
:testFunc
echo %~1 and %~2 and %~3 and %~4
exit /b
@echo off call:testFunc "AA01" "BB02" "CC03" "DD04" echo run end exit /b '受ける引数 :testFunc echo %~1 and %~2 and %~3 and %~4 exit /b
@echo off

call:testFunc "AA01" "BB02" "CC03" "DD04"
echo run end 
exit /b

'受ける引数
:testFunc
echo %~1 and %~2 and %~3 and %~4
exit /b

実行結果
>500.bat
AA01 and BB02 and CC03 and DD04
run end

batch

Posted by arkgame