def remove(path):
    r'''
    Remove the directory from the SYSTEM path

    Returns:
        boolean True if successful, False if unsuccessful

    CLI Example:

    .. code-block:: bash

        # Will remove C:\Python27 from the path
        salt '*' win_path.remove 'c:\\python27'
    '''
    path = _normalize_dir(path)
    sysPath = get_path()

    localPath = os.environ["PATH"].split(os.pathsep)
    if path in localPath:
        localPath.remove(path)
        os.environ["PATH"] = os.pathsep.join(localPath)

    try:
        sysPath.remove(path)
    except __HOLE__:
        return True

    regedit = __salt__['reg.set_value'](
        'HKEY_LOCAL_MACHINE',
        'SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment',
        'PATH',
        ';'.join(sysPath),
        'REG_EXPAND_SZ'
    )
    if regedit:
        return rehash()
    else:
        return False
dataset/ETHPy150Open saltstack/salt/salt/modules/win_path.py/remove