中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-06-14 21:51
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [已结]如何接受用户输入更改文本内容
楼 主 [已结]如何接受用户输入更改文本内容 发表于 2008-12-25 01:19 ·  中国 山东 青岛 联通
中级用户
★★
积分 253
发帖 112
注册 2005-12-20 00:31
UID 47500
状态 离线
rev.ini文本如下:
# Game Config dods.cn


# CachePath - set to the folder where your GCF files are located
#
CacheEnabled=False
CachePath=d:\Steam\SteamApps

# Language - rev emu will automagically load the correct language files.
# This can be English, French, Italian, German, Spanish, sChinese,
# Korean, Koreana, tChinese, Japanese, Russian, Thai, or Portugeuse
#
Language=sChinese

# Change Logging to True to enable/disable log file output for steam.dll
#
Logging=False

# Change SteamDll to point to your official Steam client DLL.
# This setting is required for Steam UserID Validation functions
# to support legit Steam IDs. Otherwise, all clients would get
# IDs generated from their IP addresses.
# Also make sure you uncomment the line below (remove "#")
# if you want to use this setting!
#
SteamDll=bin\steam_old.dll

# Change SteamClient to True if you want to use steamclient emulator
#
SteamClient=True

# 如果要使用steam上的用户名,请修改SteamUser后面的内容
# Defaults to revCrew if not specified
SteamUser=revCrew



# If Logging is set to True, choose which functions would you like to log.
#
FileSystem=False
Account=False
UserID=False



################################### NOTE ####################################
# These settings may apply even if you don't choose to use steamclient.dll! #
#############################################################################
#
# 玩家名称在下面修改,将DODS.CN修改为你的名字 (仅用于起源2007引擎的游戏)
#
PlayerName="test"

# Change the setting below to enable/disable log file output for steamclient.dll
#
Logging=False

# Change the setting below to enable a different master server for the server
# browser
#MasterServer=213.239.209.221


上面的rev.ini配置文件中红色字体如何用批处理接受用户输入做出相应更改

[ Last edited by HAT on 2008-12-26 at 23:19 ]
2 这样: 发表于 2008-12-25 15:27 ·  中国 江西 赣州 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
UID 96653
性别 男
状态 离线
@echo off
set /p input=请输入 PlayerName:
set file=d:\test\rev.ini
for /f "delims=" %%a in ('findstr /n .* "%file%"') do (
set "str=%%a"
if not defined Overwrite (
>"%file%" call echo.%%str:~2%%
set Overwrite=.
) else (
setlocal enabledelayedexpansion
set str=!str:*:=!
if /i "!str:~,10!"=="PlayerName" (
>>"%file%" echo PlayerName="%input%"
) else (>>"%file%" echo.!str!)
endlocal
)
)


[ Last edited by tireless on 2008-12-25 at 16:55 ]
本帖最近评分记录 (共 1 条) 点击查看详情
评分人分数时间
HAT +2 2008-12-26 23:20
3 或者这样: 发表于 2008-12-25 15:28 ·  中国 江西 赣州 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
UID 96653
性别 男
状态 离线
@echo off
set /p input=请输入 PlayerName:
set "file=d:\test\rev.ini"
more +15 %0>"%file%"
>>"%file%" echo PlayerName="%input%"
>>"%file%" echo.
>>"%file%" echo # Change the setting below to enable/disable log file output for steamclient.dll
>>"%file%" echo #
>>"%file%" echo Logging=False
>>"%file%" echo.
>>"%file%" echo # Change the setting below to enable a different master server for the server
>>"%file%" echo # browser
>>"%file%" echo #MasterServer=213.239.209.221
exit /b

# Game Config dods.cn


# CachePath - set to the folder where your GCF files are located
#
CacheEnabled=False
CachePath=d:\Steam\SteamApps

# Language - rev emu will automagically load the correct language files.
# This can be English, French, Italian, German, Spanish, sChinese,
# Korean, Koreana, tChinese, Japanese, Russian, Thai, or Portugeuse
#
Language=sChinese

# Change Logging to True to enable/disable log file output for steam.dll
#
Logging=False

# Change SteamDll to point to your official Steam client DLL.
# This setting is required for Steam UserID Validation functions
# to support legit Steam IDs. Otherwise, all clients would get
# IDs generated from their IP addresses.
# Also make sure you uncomment the line below (remove "#")
# if you want to use this setting!
#
SteamDll=bin\steam_old.dll

# Change SteamClient to True if you want to use steamclient emulator
#
SteamClient=True

# 如果要使用steam上的用户名,请修改SteamUser后面的内容
# Defaults to revCrew if not specified
SteamUser=revCrew



# If Logging is set to True, choose which functions would you like to log.
#
FileSystem=False
Account=False
UserID=False



################################### NOTE ####################################
# These settings may apply even if you don't choose to use steamclient.dll! #
#############################################################################
#
# 玩家名称在下面修改,将DODS.CN修改为你的名字 (仅用于起源2007引擎的游戏)
#
4 Re 3楼 发表于 2008-12-25 16:11 ·  美国 惠普HP
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
UID 89899
性别 男
状态 离线
PlayerName="test"下面的几行直接more一下原始ini文件更简介些吧^_^
本帖最近评分记录 (共 1 条) 点击查看详情
评分人分数时间
tireless +3 2008-12-25 16:19
5 发表于 2008-12-25 16:15 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
积分 1,488
发帖 1,357
注册 2006-05-20 12:00
UID 55770
状态 离线
#开头的注释内容全不要了吧
然后按配置文件的格式ECHO 生成一个配置文件。这样或许更好写

[ Last edited by yishanju on 2008-12-25 at 16:20 ]

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
6 发表于 2008-12-25 16:16 ·  中国 北京 鹏博士长城宽带
银牌会员
★★★★
[b]看你妹啊[/b]
积分 1,488
发帖 1,357
注册 2006-05-20 12:00
UID 55770
状态 离线
去年注释后的配置文件就像被拔光毛的狮子。




CacheEnabled=False
CachePath=d:\Steam\SteamApps

Language=sChinese


Logging=False

SteamDll=bin\steam_old.dll

SteamClient=True

SteamUser=revCrew



FileSystem=False
Account=False
UserID=False




PlayerName="test"

Logging=False

[ Last edited by yishanju on 2008-12-25 at 16:21 ]

有问题请发论坛或者自行搜索,再短消息问我的统统是SB
7 发表于 2008-12-25 16:42 ·  中国 江西 赣州 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
UID 96653
性别 男
状态 离线
Originally posted by HAT at 2008-12-25 04:11 PM:
PlayerName="test"下面的几行直接more一下原始ini文件更简介些吧^_^

我刚想说是,发现这样不对,因为我前面已经把原文件覆盖了...而且不可以 more 到同一个文件,如 more 1.txt>1.txt

[ Last edited by tireless on 2008-12-25 at 16:46 ]
8 Re 7楼 发表于 2008-12-25 16:46 ·  美国 惠普HP
版主
★★★★★
积分 9,023
发帖 5,017
注册 2007-05-31 19:39
UID 89899
性别 男
状态 离线
是的,如果要采用4楼的方法,就要使用临时文件了。
9 发表于 2008-12-26 14:33 ·  中国 山东 青岛 联通
中级用户
★★
积分 253
发帖 112
注册 2005-12-20 00:31
UID 47500
状态 离线
谢谢各位热心的大大
10 发表于 2008-12-26 19:28 ·  中国 广西 南宁 西乡塘区 电信
初级用户
积分 23
发帖 17
注册 2008-08-22 21:53
UID 123905
性别 男
状态 离线
来学习了。。看到那么多代码头有点大
论坛跳转: