Hello, i have a problem i would like to automatique the run PE mode in Windows 7, I have the commande line, when i start the .bat manually it work perfectely, but when I lauch with my programme, the cmd box said me reagentc.exe not find this is my lauch code Code: Dim CreationRestartRepairMode As New StreamWriter("C:\RestartReparMode.bat") CreationRestartRepairMode.WriteLine("@echo off") CreationRestartRepairMode.WriteLine("reagentc /boottore") CreationRestartRepairMode.WriteLine("shutdown /r") CreationRestartRepairMode.Close() System.Diagnostics.Process.Start("C:\RestartReparMode.bat") Thanks for your help
Hi, you need to set your vb.net application to run as Administrator. 1. Properties, Application, View Windows Settings 2. Replace: Code: <requestedExecutionLevel level="asInvoker" uiAccess="false" /> with Code: <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> I think creating a function to call your commands would be cleaner than writing files Code: Public Shared Function Command(ByVal Run As String) As Process Dim process As New Process() Try process.StartInfo.FileName = "cmd.exe" process.StartInfo.Arguments = "/c " & Run process.StartInfo.UseShellExecute = False process.StartInfo.RedirectStandardOutput = False process.StartInfo.CreateNoWindow = True process.Start() process.WaitForExit() process.Close() Catch End Try Return process End Function Call from your button: Code: Command("ReAgentc /boottore & shutdown -r -t 0") Not tried this, its just a quick guess..
As complement for Alphawaves post; If you haven't find the manifest, here's the default values with admin scheme: Code: <?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!--The ID below indicates application support for Windows Vista --> <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> <!--The ID below indicates application support for Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> </application> </compatibility> </asmv1:assembly> Insert as app.manifest on the properties window...
I have tried that Code: Dim CreationRestartRepairMode As New StreamWriter("C:\RestartReparMode.bat") CreationRestartRepairMode.WriteLine("@echo off") CreationRestartRepairMode.WriteLine("reagentc /boottore") CreationRestartRepairMode.WriteLine("shutdown /r") CreationRestartRepairMode.Close() Shell("C:\RestartReparMode.bat") That : Code: Sub lance() Dim p As New StreamWriter("C:\RestartReparMode.bat") p.WriteLine("@echo off") p.WriteLine("reagentc /boottore") p.WriteLine("shutdown /r") p.Close() Try Process.Start("C:\RestartReparMode.bat") Catch ex As Exception MsgBox("Logiciel introuvable ", vbExclamation, My.Application.Info.ProductName) End Try System.Threading.Thread.Sleep(500) My.Application.DoEvents() Kill "C:\RestartReparMode.bat"" System.Threading.Thread.Sleep(500) End End Sub
Hello, I have news, I have tested my program on a Windows 7 32Bit system and it work prefectely, juste the 64 Bit system doesn't work.
WOW64 Redirection is 90% of the problems using system files... 001 - Try compile the application in "Any CPU"... 002 - Please skip the batch compilation - Use the Alphawaves code for call reagentc and shutdown system files... It makes your app more "unbugged" Code: Public Shared Function CallAPP(ByVal WindowsAPP As String, ByVal Arguments As String) As Process Dim process As New Process() Try process.StartInfo.FileName = WindowsAPP process.StartInfo.Arguments = Arguments process.StartInfo.UseShellExecute = False process.StartInfo.RedirectStandardOutput = False process.StartInfo.CreateNoWindow = True process.Start() process.WaitForExit() process.Close() Catch End Try Return process End Function PS: Correct-me if the VB code is incorrect... I've no many experiences with VB
Where I should select "Any CPU" ? In the compile section in propriéties ? I use you code or Alphawave's code ? Because it's not the same
In the top toolbar in visual studio you should see a box that displays x86, click down on the box and select 'Configuration manager' Next step - A dialog box should pop up and at the top click the dropdown list 'Active platform solution' and select '<New...>', once you're in there select platform 'Any CPU' and copy settings from 'x86'. Done. Hope this helps
Hi, express editions is not offically supported for AnyCPU, you would have to do it manually: Tools tab > Options.. (check Show all settings) > inside left pane select Projects and Solutions, in right pane check Show advanced build configurations. Close project and locate the project file (open with notepad and remove this line: Code: <PlatformTarget>x86</PlatformTarget> While still in notepad replace all instances of x86 with: Code: AnyCPU close notepad (saving the file). Now you should be set for AnyCPU..
I have Visual Studio 2010 Edition Ultimate. I can't only select x86 debuging Edit : I think that i have found the "Any Cpu" option It's correct ? And if it's correct, bootore still not working :'( Re edit : I have forgotten to call my function lol, i have tested and ... IT WORK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Thanks I love you !!!!!!!!!! It's the end of 3 months of searching !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SO TO RESUM THE SOLUTION : In visual studio, open your project, go to project --> Proprieties --> Compiler --> Advenced compilation options --> target CPU , select "Any CPU" Thanks for your help ! Bye Bye