# GetFolderPath - 脚本函数

GetFolderPath 函数返回 Microsoft Windows SHGetFolderPath 函数的值。此函数获取 Microsoft Windows 文件夹的名称作为输入，并返回该文件夹的完整路径。

语法：

GetFolderPath(foldername)

参数：

GetFolderPath 参数

| 参数 | 说明 |
| --- | --- |
| foldername | Microsoft Windows文件夹的名称。<br><br>该文件夹名称不能包含空格。在 Windows Explorer 中看到的该文件夹名称中的任何空格都应从文件夹名称中删除。<br><br>示例：<br><br>MyMusic<br><br>MyDocuments |

示例和结果：

此示例的目标是获取以下 Microsoft Windows 文件夹的路径：MyMusic、MyPictures 和 Windows。添加示例脚本到应用程序并重新加载。

```
LOAD   GetFolderPath('MyMusic') as MyMusic,  GetFolderPath('MyPictures') as MyPictures,  GetFolderPath('Windows') as Windows AutoGenerate 1;
```

一旦重新加载该应用程序，就会将字段 MyMusic、MyPictures 和 Windows 添加到数据模型。每个字段均包含输入中定义的文件夹的路径。例如：

* 对于文件夹 MyMusic，路径为 C:\Users\smu\Music
* 对于文件夹 MyPictures，路径为 C:\Users\smu\Pictures
* 对于文件夹 Windows，路径为 C:\Windows