Execute an .exe from the windows start with batch

0

I have a problem that I can not solve. I have an .exe that I want to start every time Windows starts. It is loaded in the windows registers:

REG ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run /v Iniciarsoft/t REG_SZ /d "C:\inicio.bat"

home.bat runs correctly:

FOR %%X IN ("C:\soft.exe") DO rundll32 shell32.dll,ShellExec_RunDLL %%X 

This makes soft.exe run, but now the problem comes ... if I run it manually, that is, by double clicking on the .exe, the program works correctly, but if Windows starts it automatically, it does not it executes correctly, it does not fulfill the function, nor does it generate errors.

Can someone give me an idea what might be happening?

I do not know what to see anymore, I read the code infinities of times! The .exe is developed in python and has no errors, because if it is executed manually it works.

    
asked by Nahuel Jakobson 16.12.2016 в 17:02
source

2 answers

2

I think you're doing an extra step. If your file .bat the only thing you run is a file .exe , what you should do is add the file .exe in the Windows registry, this way it would be running every time the operating system starts without having to make use of a file .bat .

Another point that I managed to note is that this file would only be running for the current user since you are adding the REG ADD HKEY_CURRENT_USER register, if you want it to run for all users you should put your line something like this: REG ADD HKEY_LOCAL_MACHINE

Update

Give Inicio - > Ejecutar - > regedit and Browse to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and verify that the key has been added to the record. One option is that if it is not there, add the key / value manually. You can do this by adding a Valor de cadena , you can put the name you want and in Información del Valor you put the path where your executable file is.

To verify that it is going to run at the beginning of Windows, you can give Inicio - > Ejecutar - > msconfig and on the% tab Inicio de Windows must be the executable file that was added to the Windows Registry.

    
answered by 16.12.2016 в 17:10
0

The simplest way is to open the Inicio folder. In ejecutar ( ⊞Win + R ):

shell:startup

And create a .bat file that contains:

start C:\soft.exe
    
answered by 17.12.2016 в 05:52