but curiously the following do
> WshShell.RegWrite "HKCU\ScriptEngine\Value", 1,"REG_DWORD"
> WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 ,"REG_SZ"
I would appreciate corrections for the following:
> WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 ,"REG_SZ"
> WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 ,"REG_EXPAND_SZ"
Error: Invalid procedure call or argument
> WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 ,"REG_DWORD"
Error: Invalid procedure call or argument
> WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 ,"REG_BINARY"
Error: Invalid procedure call or argument
Alternatively, is it true that registry keys can only hold strings?
I have a second point which has come up in preparing the work above.
I run a script with CSCRIPT in a Windows 95 OSR2 DOS box.
The paste control works in a very peculiar fashion in that DOS box.
In the clipboard, I put
WshShell.RegWrite "HKCU\ScriptEngine\Value", "Some string value"
The DOS box is windowed.
I press the DOS box paste key and NOTHING HAPPENS!
I minimise the box, put the focus back on it and STILL nothing happens
I do Alt+Enter to turn the box to full screen and WshShell.R is written.
I do Alt+Enter to restore the box to a window and
egWrite "HKCU\ScriptEngine\Value", " is added to the line.
I repeat that cycle until the clipboard is fully copied to the screen.
Explanation please?
This script (cut from one in "Windows Scripting Secrets" to the minimum
needed to make my point) shows the behavior.
set input = WScript.StdIn: set output = WScript.StdOut
do until false: output.Write "> ": ExecuteIt input.ReadLine: loop
sub ExecuteIt(command)
on error resume next
ExecuteGlobal command
if err<>0 then output.WriteLine "Error: " & err.description
end sub
--
Walter Briscoe
These all work using WSH 2.0 on an NT4sp6a box (I'll try the same on a Win98 box later)... Note
that the REG_BINARY behaves differently depending on whether you use an explicit CLng() on the value
to be written...
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\mykey\szKey\", "string key" ,"REG_SZ"
WshShell.RegWrite "HKCU\mykey\szValue", "string value" ,"REG_SZ"
WshShell.RegWrite "HKCU\mykey\expandszKey\", "string %PATH% key" ,"REG_EXPAND_SZ"
WshShell.RegWrite "HKCU\mykey\expandszValue", "string %PATH% value" ,"REG_EXPAND_SZ"
WshShell.RegWrite "HKCU\mykey\dwordKey\", 1 ,"REG_DWORD"
WshShell.RegWrite "HKCU\mykey\dwordValue", 1 ,"REG_DWORD"
WshShell.RegWrite "HKCU\mykey\binKey1\", 1 ,"REG_BINARY"
WshShell.RegWrite "HKCU\mykey\binValue1", 1 ,"REG_BINARY"
WshShell.RegWrite "HKCU\mykey\binKey2\", clng(1) ,"REG_BINARY"
WshShell.RegWrite "HKCU\mykey\binValue2", clng(1) ,"REG_BINARY"
As for the DOS box paste question -- I'm not on a Win9x box to test the behavior. I'm not sure what
you mean by the "DOS paste key" but in an NT console window, keyboard paste is ALT+space followed by
EP. Using that keystroke sequence, clipboard text pastes into a console window just fine, even when
if a full screen console window...
--
Michael Harris
MVP Scripting
--
Michael Harris
MVP Scripting
"Michael Harris" <Please....@To.NewsGroup> wrote in message news:eBKlj5M8$GA.134@cppssbbsa04...
That was my experience too. I also repeated my test on an original W95
system at home and my experience was that only string registry keys
could be written. I am going to open another thread on the DOS box
experience. It was a mistake to combine the two.
--
Walter Briscoe