Powershell 中的 TabCMD

TabCMD in Powershell

我在将 bat 命令转换为我的 Powershell 脚本时遇到问题。我正在尝试在我的 PS 脚本中 运行 TabCMD(Tableau 命令)。

下面的 bat 文件有效:tabCMD.bat

cd C:\Program Files\Tableau\Tableau 9.0\bin
tableau refreshextract --server "https://online.tableausoftware.com" --username "myEmail@email.com" --password "password" --site "gameMetrics" --project "acquisition" --datasource "VisExtract"

我想将其翻译成 Powershell 脚本:PSTabCMD.ps1

$server='https://online.tableausoftware.com'
$username='myEmail@email.com'
$password='password'
$site='gameMetrics'
$project='acquisition'
$datasource='VisExtract'


Set-Location "C:\Program Files\Tableau\Tableau 9.0\bin"

$TabCMD = "tableau refreshextract --server $server --username $username --password $password --site $site --project $project --datasource $datasource"

Invoke-Expression -Command:$TabCMD

write-host 'Command complete!!'

我收到以下错误:

'tableau : The term 'tableau' is not recognized as the name of a cmdlet, function, script file, or operable program.'

我也试过将 Invoke-Expression 更改为 & "$TabCMD"start-process $TabCMD 但那些不也工作。

我需要更新几个提取物,不想调用一堆bat文件。

有人知道如何在 Powershell 中 运行 这个 TabCMD 命令吗?

谢谢!

tableau更改为.\tableau,它可能会起作用。 PowerShell 不允许您 运行 当前目录中的内容而不显式引用当前目录。