regPutValue.wsf 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <job id="putValue">
  2. <script language="VBScript" src="util.vbs" />
  3. <script language="VBScript" src="regUtil.vbs" />
  4. <script language="VBScript">
  5. usage = "usage: cscript regPutValue.wsf architecture" & vbNewLine _
  6. & "types: REG_SZ, REG_EXPAND_SZ, REG_BINARY, REG_DWORD, REG_MULTI_SZ, REG_QWORD"
  7. CheckZeroArgs(usage)
  8. DetermineOSArchitecture()
  9. LoadRegistryImplementationByOSArchitecture()
  10. ReadCount = 0
  11. Dim lineArgs(3)
  12. Do While Not stdin.AtEndOfLine
  13. strLine = stdin.ReadLine()
  14. strLine = unescape(trim(strLine))
  15. If IsNull(strLine) or strLine = "" Then
  16. WScript.Quit 25127
  17. End If
  18. lineArgs(ReadCount) = strLine
  19. ReadCount = ReadCount + 1
  20. If ReadCount = 4 Then
  21. ParseHiveAndSubKey lineArgs(0), constHive, strSubKey
  22. if IsNull(constHive) Then
  23. WriteLineErr "unsupported hive " & lineArgs(0)
  24. WScript.Quit 25122
  25. End If
  26. strValueName = lineArgs(1)
  27. strValue = lineArgs(2)
  28. strType = lineArgs(3)
  29. Result = PutValue(constHive, strSubKey, strValueName, strValue, strType)
  30. If Not Result = 0 Then
  31. WriteLineErr "error while putting value: " & result
  32. WScript.Quit Result
  33. End If
  34. ReadCount = 0
  35. Erase lineArgs
  36. End If
  37. Loop
  38. If ReadCount <> 0 Then
  39. WScript.Quit 25123
  40. End If
  41. </script>
  42. </job>