Batch file 使用批处理的文件类型关联
我正在寻找验证,然后通过批注册特定的FTA。有什么想法吗 例如,Batch file 使用批处理的文件类型关联,batch-file,Batch File,我正在寻找验证,然后通过批注册特定的FTA。有什么想法吗 例如,IF['assoc.txt']=[]转到:REGFTA :ENDREGFTA EXIT /B :REGFTA assoc .txt=txtfile 或 扩展名无效的assoc返回errorlevel 1,因此您可以使用 FOR /F "TOKENS=3 DELIMS= " %%A in ('ASSOC .TXT |FINDSTR "NOT"') DO ( IF /I "%%A" EQU "not" (assoc .txt=tx
IF['assoc.txt']=[]转到:REGFTA
:ENDREGFTA
EXIT /B
:REGFTA
assoc .txt=txtfile
或
扩展名无效的assoc返回errorlevel 1,因此您可以使用
FOR /F "TOKENS=3 DELIMS= " %%A in ('ASSOC .TXT |FINDSTR "NOT"') DO (
IF /I "%%A" EQU "not" (assoc .txt=txtfile) Else (Echo FTA Exist)
)
assoc .txt >nul 2>&1 || assoc .txt=txtfile