# GetFolderPath - 脚本函数

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

信息注释在标准模式下不支持此函数。请参阅[文件系统访问限制](https://help.qlik.com/zh-CN/sense/November2024/Subsystems/Hub/Content/Sense_Hub/LoadData/file-system-access-restriction.htm)。

语法：

GetFolderPath(foldername)

参数：

参数

| 参数 | 说明 |
| --- | --- |
| 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 添加到数据模型。每个字段均包含在输入中定义的文件夹路径。例如：

* C:\Users\smu\Music for the folder MyMusic
* C:\Users\smu\Pictures for the folder MyPictures
* C:\Windows for the folder Windows