2016-04-18 322 views
-1
@echo off 
set _logs=serverdata\logs\ 
if not exist %_logs% MKDIR %_logs% 
chcp 65001 
color 0F 
cls 
:restart 
for /f "tokens=1-4 delims=/." %%a in ("%DATE%") do (set _date=%%c-%%b-%%a) 
for /f "tokens=1-3 delims=,:" %%a in ("%TIME%") do (set _time=%%a%%b%%c) 
server.exe -batchmode -datadir "serverdata/" -oxidedir "serverdata/oxide" -logfile "%_logs%output_%_date: =0%.%_time: =0%.txt" 
timeout /T 5 
for /f "tokens=1-4 delims=/." %%a in ("%DATE%") do (set _date=%%a-%%b-%%c) 
for /f "tokens=1-2 delims=,:" %%a in ("%TIME%") do (set _time=%%a:%%b) 
echo ::::::::::::::::::::::::::::::::::::::::::::::::: 
echo :: The server was restarted - %_date% %_time% :: 
echo ::::::::::::::::::::::::::::::::::::::::::::::::: 
goto restart 

日誌不會創建。贏得2008 R2。試試這個:How to get current datetime on Windows command line, in a suitable format for using in a filename?不能創建日誌文件批處理文件

可能是引號中的問題?但它的工作!

回答

0

問題出現在UAC設置中。 禁用它們可以解決問題。