对于上述问题,我已经通过 foxidrive 得到了答案。但我再次担心这个问题。
当我从 Datefolder.bat 未保存的位置运行我的主脚本时,它不起作用。谁能建议我如何定义 Datefolder.bat 的保存位置。因此,宏可以调用 DateFolder.bat 保存的位置。
对于上述问题,我已经通过 foxidrive 得到了答案。但我再次担心这个问题。
当我从 Datefolder.bat 未保存的位置运行我的主脚本时,它不起作用。谁能建议我如何定义 Datefolder.bat 的保存位置。因此,宏可以调用 DateFolder.bat 保存的位置。
you can use this sort of command where %userprofile% expands to your own profile.
call "%userprofile%\documents\datefolder.bat"
Or the full path (but double check the path for accuracy).
call "c:\users\niki niki\documents\datefolder.bat"
But if you are using the actual current date then the best way is to automate the extraction of the current date - and where you have put the call datefolder.bat
you can put this in every batch file, and it will set the current MM-YYYY in the datefolder variable. It uses Wmic which is available in XP pro and above I think.
:: timestamp MM-YYYY
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set datefolder=%dt:~4,2%-%dt:~0,4%
echo %datefolder%