reagentc /boottore impossible to find

Discussion in 'Mixed Languages' started by BaWFrAgOr, Apr 11, 2012.

  1. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    #1 BaWFrAgOr, Apr 11, 2012
    Last edited by a moderator: Apr 20, 2017
    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 :bye1:
     
  2. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,886
    20,284
    180
    #2 Alphawaves, Apr 11, 2012
    Last edited by a moderator: Apr 20, 2017
    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 :eek:

    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..;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,519
    7,106
    120
    #3 Josh Cell, Apr 12, 2012
    Last edited by a moderator: Apr 20, 2017
    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...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    Hello,
    i have test your solution but i have the same problem
    d.PNG
     
  5. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,886
    20,284
    180
    Hi, can you post your code/app here ?;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    #6 BaWFrAgOr, Apr 15, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    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
     
  7. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    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.
     
  8. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,519
    7,106
    120
    #8 Josh Cell, Apr 24, 2012
    Last edited by a moderator: Apr 20, 2017
    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 :eek:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    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 :rolleyes:
     
  10. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,485
    1,321
    60
    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 :)
     
  11. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,886
    20,284
    180
    #11 Alphawaves, Apr 25, 2012
    Last edited by a moderator: Apr 20, 2017
    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..
    ;)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. BaWFrAgOr

    BaWFrAgOr MDL Novice

    Jul 31, 2011
    17
    1
    0
    #12 BaWFrAgOr, Apr 25, 2012
    Last edited: Apr 25, 2012
    (OP)
    I have Visual Studio 2010 Edition Ultimate. I can't only select x86 debuging
    Capture.jpg

    Edit : I think that i have found the "Any Cpu" option Capture.jpg
    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 :eek: !!!!!!!!!! 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