本帖最后由 pcl_test 于 2017-3-22 11:18 编辑
- @echo off&setlocal enabledelayedexpansion
-
- for /f "tokens=2 delims==" %%a in ('wmic path win32_operatingsystem get LocalDateTime /value ^| findstr "="') do set "strDate=%%a"
-
- set today=%strDate:~0,4%%strDate:~4,2%%strDate:~6,2%
-
- set "a=D:\test\test"
-
- if exist "%a%\%today%\" (echo;Directory already exists!) else md "%a%\%today%\"
-
- pause
复制代码
- @echo off&setlocal enabledelayedexpansion
-
- for /f "tokens=2 delims==" %%a in ('wmic path win32_operatingsystem get LocalDateTime /value ^| findstr "="') do set "strDate=%%a"
-
- set today=%strDate:~0,4%%strDate:~4,2%%strDate:~6,2%
-
- set "a=D:\ftptemp\jp24backsnd"
-
- if exist "%a%\%today%\"(echo;Directory already exists!) else md "%a%\%today%\"
-
- pause
复制代码 两段代码除了路径不同没区别啊 为什么第2个就是不成功呢 |