This is my code for shutting down the pc if a specific website has been accessed. The problem is that in VS the app is working 100%, but once I install it, that part of the code is not bring excecuted.
See code for searching for certain text and if found then shut down pc.
For Each item In ListBox2.Items
For Each item1 In ListBox1.Items
If item1.Contains(item) Then
Dim Process As Process = Process.GetProcessesByName("chrome")(0)
' Use the Process class to execute the "shutdown" command
Dim proc As New Process()
proc.StartInfo.FileName = "shutdown"
proc.StartInfo.Arguments = "-s -t 0" ' -s for shut down, -t for time in seconds
proc.StartInfo.UseShellExecute = False
proc.StartInfo.RedirectStandardOutput = True
proc.Start()
I have searched everywhere and have tried all settings on pc. Signed app, run as admin etc.
Hickman1 Hickman1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.