Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List 我的游戏服务器的三个任务批处理文件_List_Batch File_Logging_Delete File - Fatal编程技术网

List 我的游戏服务器的三个任务批处理文件

List 我的游戏服务器的三个任务批处理文件,list,batch-file,logging,delete-file,List,Batch File,Logging,Delete File,我需要3个不同的批处理文件,用于3个不同的任务: -记录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 Dedi

我需要3个不同的批处理文件,用于3个不同的任务:

-记录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!
for /f "tokens=3" %G in ('findstr /i /c:"checking..." log.txt')do echo %G>>_.log
-从未列出的任何文件或文件夹中清除服务器文件夹


我确实搜索了2天,但这是我自己能做的最远的了…

你可以缩短到

@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并重定向输出。

首先,我绝对是批处理的新手:) 关于第二个问题: -清理此日志以获取文件和文件夹列表;日志将如下所示:

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!
for /f "tokens=3" %G in ('findstr /i /c:"checking..." log.txt')do echo %G>>_.log
愿它对你有用

更新: 我下载了您的log.txt并立即进行测试,结果如下(文件名为u.log):

也许我误解了你的意思

再次更新

至于第三个问题

@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%
愿它能帮助你

第三次更新:)

因为第一版可能会让你有点困惑。很抱歉我没有很好的编码能力

@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上工作,您可能不会。因此,我建议您将我的批处理文件调整到您的操作系统。在运行之前,请检查您是否有
xcopy
rm
rename
为您工作。T

可能应该在末尾添加
start notepad log.txt
行。不管怎样,文件扩展名没有显示是什么原因?OP似乎没有提到他们的任何问题。我遗漏了什么?@AndriyM是的,我想是的,最后一点是关于OP对应用程序输出的评论-
等等。。。以后的文件没有扩展名啊,我怎么会错过呢?我想我只是把那一行的
等之后的所有事情都当作无关紧要的事情来处理了。:)谢谢是的,我也差点错过了:)更短更准确,但不幸的是,效果和我已经拥有的一样。我希望在控制台将输出写入日志时直接在控制台中查看输出。至于其余的我仍然需要帮助:(@AirMax95s)我可以看一下您在1号输出的日志文件吗question@AirMax95s我更新了答案,因为我不能很好地格式化评论。我得到了“检查…”这一次是出乎意料的。“没有创建任何内容,我做错什么了吗?”:/也许你应该检查路径,因为我在这个命令中使用了相对路径?好的,我在第一个命令中将%G替换为%%G:)至于另一个命令,我得到了很多“无效参数数”,并且“'rm'不能识别为内部或外部命令、可操作程序或批处理文件。”再次感谢您的帮助!