# [Guide] Run OBS at startup and Start Replay Buffer [AHK]



## banOBS (Jun 13, 2017)

Hello,

this is a simple way to reliably have your OBS Studio startup with Windows, with replay buffer enabled.

Prerequisites:
AutoHotkey
OBS Studio:
-replay buffer enabled (Settings, Output -> Enable Replay Buffer)
-set hotkey for Save Replay (Settings, Hotkeys) Ctrl + Shift + S is used in the guide

1. Create the AutoHotkey script
Open Notepad, paste this code and save it as "Something.ahk" (make sure you're not saving it as ahk.txt).

```
full_command_line := DllCall("GetCommandLine", "str")
if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
  try
  {
  if A_IsCompiled
  Run *RunAs "%A_ScriptFullPath%" /restart
  else
  Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
  }
  ExitApp
}
Run C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OBS Studio\OBS Studio (64bit) ; must be shortcut
Sleep 4000
Send {LControl Down}{LShift Down}{e Down} ; change this to your "Save Replay" hotkey, see list of hotkeys at https://autohotkey.com/docs/KeyList.htm
Sleep 200
Send {LControl Up}{LShift Up}{e Up}
```

Make sure the file location is correct on the "Run ..." line. To get the correct location right click your OBS Studio shortcut from desktop or Start menu, select Open file location and look at the path there. You cannot use direct path to "Program Files (x86)\obs-studio\bin", you need to use the shortcut path.

2. Add the AutoHotkey script to startup
Open "Run" by pressing Windows + R, type "shell:startup" and click OK. Paste your .ahk file in here to add it to startup.

Now as you start your PC the AutoHotkey script will re-launch itself as admin, launch OBS Studio and press the hotkey to Start your replay buffer.

Hope this helps!


----------



## dodgepong (Jun 13, 2017)

Or just run OBS with the --startreplaybuffer parameter.


----------



## banOBS (Jun 13, 2017)

dodgepong said:


> Or just run OBS with the --startreplaybuffer parameter.



Wow that actually works now, I've looked all over on how to do this and nobody had a solution. You can delete the thread.

Edit: still can't make OBS Studio auto startup without the AKH script though


----------



## G3yost (Mar 20, 2018)

Hey banOBS I know that it's been most of a year since your post here, but you can just make a shortcut where you have in the "Target" field '"%OBSPATH%" --startreplaybuffer' then place that in "%appdata%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\" that will start the program when you boot into windows.


----------

