salt.modules.win_path

Manage the Windows System PATH

Note that not all Windows applications will rehash the PATH environment variable, Only the ones that listen to the WM_SETTINGCHANGE message http://support.microsoft.com/kb/104011

salt.modules.win_path.add(path, index=0)

Add the directory to the SYSTEM path in the index location

Returns:
boolean True if successful, False if unsuccessful

CLI 范例:

# Will add to the beginning of the path
salt '*' win_path.add 'c:\python27' 0

# Will add to the end of the path
salt '*' win_path.add 'c:\python27' index='-1'
salt.modules.win_path.exists(path)

Check if the directory is configured in the SYSTEM path Case-insensitive and ignores trailing backslash

Returns:
boolean True if path exists, False if not

CLI 范例:

salt '*' win_path.exists 'c:\python27'
salt '*' win_path.exists 'c:\python27\'
salt '*' win_path.exists 'C:\pyThon27'
salt.modules.win_path.get_path()

Returns a list of items in the SYSTEM path

CLI 范例:

salt '*' win_path.get_path
salt.modules.win_path.rehash()

Send a WM_SETTINGCHANGE Broadcast to Windows to refresh the Environment variables

CLI 范例:

... code-block:: bash

salt '*' win_path.rehash
salt.modules.win_path.remove(path)

Remove the directory from the SYSTEM path

Returns:
boolean True if successful, False if unsuccessful

CLI 范例:

# Will remove C:\Python27 from the path
salt '*' win_path.remove 'c:\\python27'