Skip to content

Commit 3cbf4e2

Browse files
committed
Replace reg.exe with StdRegProv to avoid window popping up
#34
1 parent 02049f8 commit 3cbf4e2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

resource/ShowAllTrayIcons.vbs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
Set shell = CreateObject( "WScript.Shell" )
2-
Set exec = shell.Exec( "reg.exe QUERY ""HKCU\Control Panel\NotifyIconSettings""" )
3-
Set re = New RegExp
4-
re.Pattern = "^HKEY_CURRENT_USER\\Control Panel\\NotifyIconSettings\\\d+$"
5-
While Not exec.StdOut.AtEndOfStream
6-
line = exec.StdOut.ReadLine
7-
If re.Test( line ) Then
8-
shell.RegWrite line + "\IsPromoted", 1, "REG_DWORD"
1+
HKCU = &H80000001
2+
key = "Control Panel\NotifyIconSettings"
3+
Set reg = GetObject("winmgmts://./root/default:StdRegProv")
4+
If reg.EnumKey(HKCU, key, names) = 0 Then
5+
If Not IsNull(names) Then
6+
For Each name In names
7+
reg.SetDWORDValue HKCU, key + "\" + name, "IsPromoted", 1
8+
Next
99
End If
10-
Wend
10+
End If

0 commit comments

Comments
 (0)