r"""
    Writes a registery script to update the PATH variable into the sync registry

    CommandLine:
        python -m utool.util_win32 --test-add_to_win32_PATH --newpath "C:\Program Files (x86)\Graphviz2.38\bin"

    Example:
        >>> # DISABLE_DOCTEST
        >>> # SCRIPT
        >>> from utool.util_win32 import *  # NOQA
        >>> script_fpath = join(ut.truepath('~'), 'Sync/win7/registry', 'UPDATE_PATH.reg')
        >>> new_path = ut.get_argval('--newpath', str, default=None)
        >>> result = add_to_win32_PATH(script_fpath, new_path)
        >>> print(result)

def add_to_win32_PATH(script_fpath, *add_path_list):
    r"""
    Writes a registery script to update the PATH variable into the sync registry

    CommandLine:
        python -m utool.util_win32 --test-add_to_win32_PATH --newpath "C:\Program Files (x86)\Graphviz2.38\bin"

    Example:
        >>> # DISABLE_DOCTEST
        >>> # SCRIPT
        >>> from utool.util_win32 import *  # NOQA
        >>> script_fpath = join(ut.truepath('~'), 'Sync/win7/registry', 'UPDATE_PATH.reg')
        >>> new_path = ut.get_argval('--newpath', str, default=None)
        >>> result = add_to_win32_PATH(script_fpath, new_path)
        >>> print(result)
    """
    import utool as ut
    write_dir = dirname(script_fpath)
    key = '[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]'
    rtype = 'REG_EXPAND_SZ'
    # Read current PATH values
    win_pathlist = list(os.environ['PATH'].split(os.path.pathsep))
    new_path_list = ut.unique_ordered(win_pathlist + list(add_path_list))
    #new_path_list = unique_ordered(win_pathlist, rob_pathlist)
    print('\n'.join(new_path_list))
    pathtxt = pathsep.join(new_path_list)
    varval_list = [('Path', pathtxt)]
    regfile_str = make_regfile_str(key, varval_list, rtype)
    ut.view_directory(write_dir)
    print(regfile_str)
    ut.writeto(script_fpath, regfile_str, mode='wb')
    print('Please have an admin run the script. You may need to restart')