I installed sqlcmd utility into Azure Batch Node (this is regular windows VM). So, I have bcp utility on this VM. How I can specify path to bcp.exe in Azure Batch job?
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);
}
Is it right way to specify full path like
string taskCommandLine = String.Format("cmd c/ 'D:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\bcp.exe'");
You have a few ways to launch a command in a different path:
PATH
environment variable. Ensure you are using a shell command (cmd.exe
).For your particular case, your command is malformed. When executing with cmd.exe
, it should be cmd.exe /c <your command>
.