Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8088

Профиль | Отправить PM | Цитировать


На WSH:
Скрытый текст
Код: Выделить весь код
Option Explicit

Dim strSourceFile

If WScript.Arguments.Count = 1 Then
	strSourceFile = WScript.Arguments.Item(0)
	
	If WScript.CreateObject("Scripting.FileSystemObject").FileExists(strSourceFile) Then
		With WScript.CreateObject("Microsoft.XMLDOM")
			.load(strSourceFile)
			
			With .selectSingleNode("/Settings/DB/Server")
				.text = Replace(.text, "USER-PC", WScript.CreateObject("WScript.Network").ComputerName)
			End With
			
			.Save strSourceFile
		End With
	Else
		WScript.Echo "Can't find source file [" & strSourceFile & "]."
		WScript.Quit 2
	End If
Else
	WScript.Echo "Usage: cscript.exe //nologo """ & WScript.ScriptName & """ <Source file>"
	WScript.Quit 1
End If

WScript.Quit 0
Это сообщение посчитали полезным следующие участники:

Отправлено: 22:51, 19-01-2017 | #8