Ashaduzaman Bhuiyan
Ashaduzaman Bhuiyan

Reputation: 11

Restart PC Then Automatically Execute this step

This is my bat file code:

@ECHO OFF 
set FolderPath="C:\ForSSSSetupNeed"

IF EXIST "C:\ForAFCSSetupNeed" setup.exe

IF NOT EXIST "C:\ForAFCSSetupNeed" ( 
    mkdir c:\ForSSSSetupNeed
    abc.bat
    ECHO GELLO
    shutdown -r /t 00  
    setup.exe
)
PAUSE

When C:\ForSSSSetupNeed file is absent, the batch file will create the C:\ForSSSSetupNeed file and restart my PC.

After the restart of my PC, I want to have it automatically execute the setup.exe

How can I do that?

Please help me

Upvotes: 0

Views: 85

Answers (2)

user253984
user253984

Reputation:

What you want to do is create a RunOnce entry for that executable. You can use the reg command to create the key, e.g.

reg ADD HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce /v Foo /t REG_SZ /d "C:\\mysetup.exe"

Upvotes: 2

BinaryThor
BinaryThor

Reputation: 49

you could copy setup.exe to %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\, make setup.exe copy itself to %TMP% then delete the copy in the startup folder. A hack but should work

Upvotes: 0

Related Questions