-1

Got so far, but I'm stuck now. Need to from an VB app, change windows registry. CMD window opens in admin mode but no argument is passed. Im guessing argument is not the right trick ...but also tried making one string only cmd.exe red add ... and no argument.

My problem is that the CMD window opens but the REG ADD ... Is not passed

Private Sub StartProcess(ByVal app As String, ByVal arg As String, ByVal verb As 
String)
    Dim p As New ProcessStartInfo
    p.FileName = app                                                                        
    p.Arguments = arg
    p.Verb = verb                                                                           
    Process.Start(p)
End Sub

Private Sub explorer_btn_Click(sender As Object, e As EventArgs) Handles 
explorer_btn.Click
call StartProcess("cmd", "reg add ""HKey_Local_Machine\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"" /v Shell /t reg_sz /d ""explorer.exe"" "", "runas")
End Sub
SirAleXbox
  • 101
  • 1
  • 14

1 Answers1

0

Looks like I was missing /C or /K before the REG ADD command. From cmd /? /C Carries out the command specified by string and then terminates. /K Carries out the command specified by string but remains.

SirAleXbox
  • 101
  • 1
  • 14
  • Important note: When building the .exe it must be for x64 platform, or the registry key will be placed in: [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\Winlogon] instead of: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] – SirAleXbox Jul 22 '18 at 14:01