2012-07-19 47 views
0

我需要3個不同的任務,3個不同的批處理文件:三爲我的遊戲服務器的任務批處理文件

-log HldsUpdateTool.exe控制檯的輸出,到目前爲止,我沒有看到發生了什麼事情,但我設法這個:

@echo off 
echo Updating... 
call :Logit>>log.txt 2>&1 
exit /b 0 
:Logit 
hldsupdatetool.exe -command update -game "Counter-Strike Source" -dir "Source 2007 Dedicated Server" -verify_all -retry 
start notepad log.txt 

- 清理此日誌以獲取文件和文件夾列表;日誌將如下所示:

Checking bootstrapper version ... 
Updating Installation 
Determining which depot(s) to install/update... 
5 depot(s) will be installed/updated 
    0:30 Checking local files and building download list for depot 242 'Counter-Strike Source Shared' version 126 
    0:30  Connecting content server session for version 126 
    0:31  [80.239.194.146:27030] Connecting... 
    0:31  [80.239.194.146:27030] Connection established; handshaking... 
    0:31  [80.239.194.146:27030] Sending login message... 
    0:31  Fetching version 126 manifest 
    0:41  Reading version 126 checksum table 
    0:54  Calculating download size and verifying checksums 
    0:54   Checking...:/
    0:54   Checking...: cstrike 
    0:54   Checking...: cstrike\bin 
    0:54   Checking...: cstrike\cfg 
    0:54   Checking...: cstrike\classes 
    0:54   Checking...: cstrike\maps 
    0:54   Checking...: cstrike\maps\graphs 
    0:54   Checking...: cstrike\maps\soundcache 
    0:57   Checking...: cstrike\materials 
    0:57   Checking...: cstrike\materials\brick 
    0:57   Checking...: cstrike\materials\buildings 
    0:57   Checking...: cstrike\materials\carpet 
    0:57   Checking...: cstrike\materials\composite 
    0:57   Checking...: cstrike\materials\concrete 
    0:58   Checking...: cstrike\materials\console 
etc... later on files do not have extensions! 

- 清除未列出的任何文件或文件夾的服務器文件夾!

我搜索周圍2天,但是這是據我可以自己去...

回答

0

首先,我是批次肯定更新:) 至於第二個問題: - 清理此日誌以獲取文件和文件夾列表;日誌將如下所示:

for /f "tokens=3" %G in ('findstr /i /c:"checking..." log.txt')do echo %G>>_.log 

可能適用於您。

更新: 我下載你的log.txt和測試立即,這是結果(文件名_.log):

/ 
cstrike 
cstrike\bin 
cstrike\cfg 
cstrike\classes 
cstrike\maps 
cstrike\maps\graphs 
cstrike\maps\soundcache 
cstrike\materials 
cstrike\materials\brick 
cstrike\materials\buildings 
cstrike\materials\carpet 
cstrike\materials\composite 
cstrike\materials\concrete 
cstrike\materials\console 
cstrike\materials\cs_assault 
cstrike\materials\cs_havana 
cstrike\materials\cs_italy 
cstrike\materials\cstrike 
cstrike\materials\de_aztec 
cstrike\materials\de_cbble 
cstrike\materials\de_chateau 
cstrike\materials\de_dust 
cstrike\materials\de_nuke 
cstrike\materials\de_piranesi 
cstrike\materials\de_prodigy 
cstrike\materials\de_tides 
cstrike\materials\de_train 
cstrike\materials\decals 
cstrike\materials\decals\concrete 
cstrike\materials\decals\metal 
cstrike\materials\decals\wood 
... 

也許我誤解你的意思?

再次更新

至於第三個問題

@echo off 
set /p origin=Where is the original folder?(Type absoulute path directly.) 
echo origin: %origin% 
set /p destin=Where can i put file temporarily(Type absoulute path directly.) 
echo destination :%destin% 


for /f %%G in (_.log) do (
if "%%G"=="/" (
    echo. 
) else ( 
    xcopy %origin%\%%G %destin%\%%G /H /K /R /E /D /I /Y 
)) 

rm -rf %origin% 
set /p origin=What is the name of original folder?(Type name) 
rename %destin% %origin% 

它可以幫助你!

更新第三次:)

因爲第一版也許對you.Sorry有點混亂,我的能力TI代碼缺乏良好。

@echo off 
setlocal enabledelayedexpansion 
set MAXNUM=100 

set /p origin=Where is the original folder?(Type absoulute path directly.) 
echo origin: %origin% 
set backup_origin=%origin% 

for /L %%H in (1,1,%MAXNUM%) do (
for /F "delims=\" %%G in ("!origin!") do (
set name=%%G 
set origin=!origin:%%G\=! 
)) 
set father=!backup_origin:\%name%=! 

xcopy !father!\!name! !father!\backup_!name! /H /K /R /E /D /I /Y 
::copy files 
rm -rf !father!\!name! 
::delete origin 
rename !father!\backup_!name! !name! 
::rename the new folder using the old's name 

如果你的文件是在這樣的格式C:\template\example\cstrike\materials\brick,你應該只需要輸入c:\template\example,其中包括\hl2\cstrike等。
我Win7上,你可能not.So我建議你調整我的批處理文件到您的OS.Before運行,檢查是否有xcopyrmrename工作you.T

+0

謝謝,但我試過了,它似乎不起作用... – AirMax95s 2012-07-19 20:27:18

+0

@ AirMax95s我可以看看你的第一個問題輸出的日誌文件 – yuan 2012-07-19 23:50:31

+0

http://www.mediafire.com/?c5zhynsa974dlj0你可以在這裏下載,謝謝:) – AirMax95s 2012-07-20 00:31:02

1

可以縮短,要

@echo off 
hldsupdatetool.exe -command update -game "Counter-Strike Source" -dir "Source 2007 Dedicated Server" -verify_all -retry >Log.txt 
start notepad Log.txt 

與文件不顯示的附加問題將下到你正在運行的程序,所有的批處理都會調用exe並重定向輸出。

+0

也許'開始工作記事本應該在最後添加log.txt行。無論如何,這是什麼文件擴展名不顯示? OP似乎沒有提到他們的任何問題。我錯過了什麼? – 2012-07-19 13:43:37

+0

@AndriyM是的,我想是的,最後一點是關於OP對應用輸出的評論 - 「等等......後來文件沒有擴展名!' – 2012-07-19 13:45:24

+0

啊,我怎麼會錯過?我想我只是把'etc'之後的所有內容都排除在外,不重要。 :) 謝謝! – 2012-07-19 13:50:59