deseja adicionar reg usando vbscript

0

vbs code are as following :

Set oShell = CreateObject ("Wscript.Shell")
Dim strArgs
strArgs = "cmd /c REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RUN" /v "MyCustomWorkgroupUsername" /t REG_DWORD /d 0"
oShell.Run strArgs, 0, false

Error message :

Line :3
Char:28 
Error: Expected end of statement 
Code:800A0401
Source: Microsoft VBScript compilation error
    
por user3275899 15.10.2018 / 12:33

1 resposta

1

I have used double " instead of single " and its working fine for me.

Set oShell = CreateObject ("Wscript.Shell")
    Dim strArgs
    strArgs = "cmd /c REG ADD ""HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RUN"" /v ""MyCustomWorkgroupUsername"" /t REG_DWORD /d 0"
    oShell.Run strArgs, 0, false
    
por 15.10.2018 / 13:03