0

zean.xmlアプリケーションのユーザーの1人が、場所にfile という名前のxmlを持っていますC:\ProgramData\Secon\levrer\8.6.7\team\lead\Captain folder。しかし、一時的な回避策として、xmlファイルのコンテンツを次のコンテンツに置き換える必要があると感じています。このxmlファイルを使用しているユーザーに提供できるように、vbscriptまたはbatファイルを作成することを考えました。次のコンテンツでxmlファイルを書き換えるためのvbscriptコードまたはbatファイルを提供してくれる団体はありますか?

  <?xml version="1.0" standalone="yes" ?> 
 <TestSchema xmlns="http://tempuri.org/TestSchema.xsd">
  <UserZone>
  <Label>All</Label> 
  <ID>8c19c791-32d6-4ad1-8504-c3387b5a0096</ID> 
  </UserZone>
 <ZoneMgGrpCollection>
  <Owner>8c19c791-32d6-4ad1-8504-c3387b5a0096</Owner> 
  <MgGrpID>5f498b70-ee75-4ff0-8808-b9ba492b7f8a</MgGrpID> 
  </ZoneMgGrpCollection>
  </TestSchema>
4

1 に答える 1

1

新しいXMLファイルにテキストを追加してから、他のXMLファイルにコピーするだけです。手動でもスクリプトでも実行できますが、これは明らかに1回限りの操作であるため、スクリプトで実行する理由がわかりません。

Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNeeded = true
Set fso = CreateObject("Scripting.FileSystemObject")
set tf=fso.OpenTextFile ("new.xml",ForWriting,CreateIfNeeded)
tf.write "<?xml version=""1.0"" standalone=""yes"" ?>  "
'repeat this for the other lines
tf.close
fso.CopyFile("new.xml", "C:\ProgramData\Secon\levrer\8.6.7\team\lead\Captain folder\",True)
于 2012-05-22T11:27:58.010 に答える