Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Powershell函数编辑文件元数据(从MATLAB调用)_Matlab_Powershell_Attributes_Metadata - Fatal编程技术网

使用Powershell函数编辑文件元数据(从MATLAB调用)

使用Powershell函数编辑文件元数据(从MATLAB调用),matlab,powershell,attributes,metadata,Matlab,Powershell,Attributes,Metadata,我正在尝试使用Powershell以编程方式访问本地文件元数据(类似于.mp3文件中的“Authors”或“Album”等字段)(主要原因是,在我看来,这是从MATLAB实现此目的最可行的方法) 到目前为止,我已经设法读取了元数据。我提出了以下功能: param( [string]$folderName = "C:\temp\Powershell\test", [string]$fileName = "test.txt", [string]$attrNam

我正在尝试使用Powershell以编程方式访问本地文件元数据(类似于.mp3文件中的“Authors”或“Album”等字段)(主要原因是,在我看来,这是从MATLAB实现此目的最可行的方法)

到目前为止,我已经设法读取了元数据。我提出了以下功能:

param(        
    [string]$folderName = "C:\temp\Powershell\test",
    [string]$fileName = "test.txt",
    [string]$attrNameToSearch = "Size"
    )


$objShell = New-Object -ComObject Shell.Application  
$objFolder = $objShell.namespace($folderName) 

$iAttr = 0     
while($objFolder.getDetailsOf($objFolder.items, $iAttr) -ne $attrNameToSearch) {
    $iAttr += 1    
}

$file = $objFolder.ParseName($fileName)

$attrValue = $objFolder.getDetailsOf($file, $iAttr)             

return $attrValue 
从ISE以及我从MATLAB调用它时,它似乎可以完美地工作:

cmd = sprintf(['powershell -file psFunction4.ps1 -folderName c:\\temp\\Powershell\\test -fileName ', fileNames{iF}, ' -attrName Size']);
[~, b] = system(cmd)
现在的问题是:有没有办法使用类似的方法来编辑metada


提前谢谢。

我可以做你想做的事。但这取决于要编辑的文件元数据类型。你能说得更具体一点吗?谢谢你的回答,多米尼克。我特别想要的是访问(读取和编辑)一个.mdf文件的特定字段(“注释”),这是数据采集系统保存测量数据的格式。我想更常见的例子是编辑mp3文件的“作者”或“相册”之类的内容。