判断方法: DirectoryInfo di = new DirectoryInfo(path); if ((di.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) //为隐藏的 同理可以判断目录是否为只读(ReadOnly)或者系统(System)等其他属性.
bat 判断变量字符串中是否包含字符串 @echo off rem way 1 set str=machine-order-service set matchStr=orderd echo %str% | findstr %matchStr% >nul && echo yes || echo no rem end way 1 pause rem way 2 setLocal EnableDelayedExpansion if not "x!str:%matchStr%=!&
方法一: for /r D:\要遍历的目录\ %%i (*.exe) do ( echo %%i ) 方法二: set DestPath=D:\你的目录\ rem 你的后缀 set DestExt=*.exe for /f "delims=" %%i in ('dir /b/a-d/s %DestPath%\%DestExt%') do ( echo %%i )