IF [NOT] EXIST file THEN
command [arguments]
[ELSE
command [arguments]]
ENDIF
IF [NOT] string1 == string2 THEN
command [arguments]
[command [arguments]]
...
[ELSE
command [arguments]
[command [arguments]]
...]
ENDIF
EXIST file - TRUE if file exists in the directory
string1 == string2 - TRUE if the two stings are same
Note:
1. The IF command is only available in batch script files.
2. If condition is TRUE, commands between IF and ELSE will be
executed.
3. If condition is FALSE but keyword 'NOT' is not prefixed, commands
between ELSE and ENDIF will also be executed.
Examples:
#
# Example script for "if" command
#
if exist fs0:\myscript.sc then
myscript myarg1 myarg2
endif
if %myvar% == runboth then
myscript1
myscript2
endif
How to input a parameter and check its word from shell command line?
回覆刪除1. make a file which name is "test.nsh".
2. content:
#
# test.nsh
#
if %1% == yes then
echo "output:" %1
endif
3: fs0:\> test.nsh yes
output: yes
請問win command有find /c /i這個指令?UEFI有嗎?這是可以check txt內的關鍵字
回覆刪除目前UDK/EDK Shell Library可能沒有,要寫程式判斷。
回覆刪除