C
Campone
Guest
Hello,
I want to use "Administrator Mode Cmd" in multi command. I try maked attached code, this code working but always asking for administrator login password.
So need just asking for an administrator password, I need help for this about.
Sorry for language errors I'm trying to improve myself.
Thank you for help , Best Regards
Private Function RunCmd() As Integer
Try
Dim process As New Process()
process.StartInfo.FileName = "cmd.exe"
process.StartInfo.Verb = "runas"
process.StartInfo.UseShellExecute = True
Dim AppVar As String = appPath + "\Application.txt"
Dim DataVar As String = appPath + "\Data001.xml"
Dim RegionVar As String = appPath + "\Region.xml"
Dim ErrorVar As String = appPath + "\error.txt"
Dim Pathx As String
Try
commander = "HKEY_LOCAL_MACHINE\SOFTWARE\APP\" + AppNameVar.ToString()
Pathx = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\Windows\Safety\AnlasOtomasyon\" + AppNameVar.ToString())
Catch ex As Exception
End Try
process.StartInfo.Arguments = "/K reg delete """ + commander + """ /f & exit"
process.Start()
process.StartInfo.Arguments = "/K rd /s /q " + Pathx + " & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + DataVar + """ & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + RegionVar + """ & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + ErrorVar + """ & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + AppVar + """ & exit"
process.Start()
process.WaitForExit()
Return 0
Catch
Return 1
End Try
End Function
sorry for language errors I'm trying to improve myself.
Continue reading...
I want to use "Administrator Mode Cmd" in multi command. I try maked attached code, this code working but always asking for administrator login password.
So need just asking for an administrator password, I need help for this about.
Sorry for language errors I'm trying to improve myself.
Thank you for help , Best Regards
Private Function RunCmd() As Integer
Try
Dim process As New Process()
process.StartInfo.FileName = "cmd.exe"
process.StartInfo.Verb = "runas"
process.StartInfo.UseShellExecute = True
Dim AppVar As String = appPath + "\Application.txt"
Dim DataVar As String = appPath + "\Data001.xml"
Dim RegionVar As String = appPath + "\Region.xml"
Dim ErrorVar As String = appPath + "\error.txt"
Dim Pathx As String
Try
commander = "HKEY_LOCAL_MACHINE\SOFTWARE\APP\" + AppNameVar.ToString()
Pathx = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\Windows\Safety\AnlasOtomasyon\" + AppNameVar.ToString())
Catch ex As Exception
End Try
process.StartInfo.Arguments = "/K reg delete """ + commander + """ /f & exit"
process.Start()
process.StartInfo.Arguments = "/K rd /s /q " + Pathx + " & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + DataVar + """ & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + RegionVar + """ & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + ErrorVar + """ & exit"
process.Start()
process.StartInfo.Arguments = "/K del /f """ + AppVar + """ & exit"
process.Start()
process.WaitForExit()
Return 0
Catch
Return 1
End Try
End Function
sorry for language errors I'm trying to improve myself.
Continue reading...