vbs代码如下:
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
错误信息 :
Line :3
Char:28
Error: Expected end of statement
Code:800A0401
Source: Microsoft VBScript compilation error
答案1
我使用双“而不是单“并且对我来说效果很好。
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