nn, path2 =  reaper.JS_Dialog_BrowseForFolder("Reaper portable","cd")
if path2 == "" then return end
path2 =  path2 .. "\\"
local path = reaper.GetExePath()
local path5 = reaper.GetResourcePath() 
  local CopyCmd = reaper.GetOS():find("Win") and 'xcopy ' or 'cp '
  local CopyCmd2 = reaper.GetOS():find("Win") and 'c:\\windows\\system32\\cmd.exe /Q /C '
mena =CopyCmd2..CopyCmd      ..'"' .. path ..'" "'  .. path2 ..'" ' ..  ' /E /Y'
mena1 =CopyCmd2..CopyCmd      ..'"' .. path5 ..'" "'  .. path2 ..'" ' ..  ' /E /Y'
 reaper.ExecProcess(mena, 0)
 reaper.ExecProcess(mena1, 0)

reaper.BR_Win32_WritePrivateProfileString("reaper", "wnd_state", 0, path2 .. "\\REAPER.ini")
    if reaper.GetOS() == "OSX32" or reaper.GetOS() == "OSX64" then;
        os.execute('open "'..path2..'"');
    else;
        os.execute('start "" '..path2);
    end;
