gpt4 book ai didi

azure - 如何在 Azure Batch 任务中调用预安装的应用程序?

转载 作者:行者123 更新时间:2023-12-02 08:32:29 26 4
gpt4 key购买 nike

我将 sqlcmd 实用程序安装到 Azure Batch Node(这是常规 Windows VM)中。因此,我在此虚拟机上有 bcp 实用程序。如何在 Azure Batch 作业中指定 bcp.exe 的路径?

 using (BatchClient batchClient = BatchClient.Open(cred))
{
string jobId = "1";
CloudJob job = batchClient.JobOperations.GetJob(jobId);
job.Commit();

string taskCommandLine = String.Format("cmd c/ 'D:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\bcp.exe'");

string uniqueIdentifier = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", "");
string taskId = String.Format(name.Replace(".", string.Empty) + "-" + uniqueIdentifier);

CloudTask task = new CloudTask(taskId, taskCommandLine);
task.UserIdentity = new UserIdentity(new AutoUserSpecification(elevationLevel: ElevationLevel.Admin, scope: AutoUserScope.Task));

batchClient.JobOperations.AddTask(jobId, task);
}

指定完整路径是否正确

string taskCommandLine = String.Format("cmd c/ 'D:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\bcp.exe'");

最佳答案

您有几种方法可以在不同的路径中启动命令:

  1. PATH 中指定可执行文件目录environment variable 。确保您使用的是 shell 命令 ( cmd.exe )。
  2. 将工作目录更改为包含可执行文件的正确目录
  3. 根据您的帖子在任务命令行中指定完整路径。

对于您的特定情况,您的命令格式错误。当使用 cmd.exe 执行时,应该是cmd.exe /c <your command> .

关于azure - 如何在 Azure Batch 任务中调用预安装的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59610182/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com