Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: regqueryvalue dataitem key subkey
The function creates a new key and value OK if the key does not exist, however the RegQueryValue of rkey then returns an error. Why?
Assuming "current_tag" is a key, here's how to use RegQueryValue:
ErrorMode(@off) ; See warnings LastError() ctag = RegQueryValue(@REGCURRENT, "software\peoplesoft\PSVerTag\CURRENT_TAG") err=LastError() ErrorMode(@cancel) if err==0 ; it exists Message("Current_tag default value is",ctag) else rkey = RegCreateKey(@REGCURRENT, "software\peoplesoft\PSVerTag\CURRENT_TAG") RegSetValue(rkey, "","New User") RegCloseKey(rkey) MESSAGE("Current_tag","New User") endifAssuming "current_tag" is a dataitem, here's how to use RegQueryValue:
ErrorMode(@off) ; See warnings LastError() ctag = RegQueryValue(@REGCURRENT, "software\peoplesoft\PSVerTag[CURRENT_TAG]") err=LastError() ErrorMode(@cancel) if err==0 ; it exists Message("Current_tag default value is",ctag) else rkey = RegCreateKey(@REGCURRENT, "software\peoplesoft\PSVerTag") RegSetValue(rkey, "[CURRENT_TAG]","New User") RegCloseKey(rkey) MESSAGE("Current_tag","New User") endif
Article ID: W13716
Filename: DataItem or Subkey - Does Key Exist and RegQueryValue.txt
File Created: 1999:04:15:16:55:54
Last Updated: 1999:04:15:16:55:54