2

I am using Azure batch. I have an exe which I need to execute on compute nodes.

I am using this path in the azure portal in my task window "cmd /c %AZ_BATCH_APP_PACKAGE_MyAppCreateRG%\CreateRG.exe -args HelloRG eastUs"

But I am getting an error: The system cannot find the path specified.

fpark
  • 2,304
  • 2
  • 14
  • 21
user1037747
  • 1,307
  • 2
  • 18
  • 38

3 Answers3

1

For your issue, the error you got is the core point of your problem. You can create a task with the command cmd /c "echo %AZ_BATCH_APP_PACKAGE_MyAppCreateRG%" to show the exact path if it exists or not.

Just like if you want to get the environment variable PATH in windows, you should use the command echo %PATH%. And the result will like below:

enter image description here

So, if it could not show the path you want, it means the environment variable doesn't exist and you should set it up first and check then.

I suggest if you want to execute an exe, you should check if the path of it is right and if the exe already exist for you.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • Yes I was missing the application package (zip file which contains exe). I added the package and I did echo of the path as you suggested and I got this as an output "D:\batch\tasks\apppackages\myappcreaterg12018-09-02-19-19". Do I have to use this path ? As now nothing is happening. Exe is not executing. Any suggestion ? – user1037747 Sep 03 '18 at 18:08
  • @user1037747 For you, if the path is not you want, just find the exact path of the exe which you want to execute, then use the command `cmd /c "/path/CreateRG.exe -args HelloRG eastUs"`. – Charles Xu Sep 04 '18 at 00:48
  • @user1037747 If the answer is helpful or for more help, please me know. – Charles Xu Sep 04 '18 at 06:15
  • Yes i need more help. If you can tell me which path i should assign for the exe to execute it will be helpfull – user1037747 Sep 04 '18 at 06:56
  • @user1037747 This need more details, such as the backend pool image, and where the exe from? Does it you upload or exist in the image? – Charles Xu Sep 04 '18 at 07:01
  • No I have created a Golden image.. Added that image in the application pool. So the exe is not there in the image. The exe i have added in Application package – user1037747 Sep 04 '18 at 07:04
  • @user1037747 You create the image and don't you know the exact path of the exe? – Charles Xu Sep 04 '18 at 07:29
  • @user1037747 You can try the command `cmd /c "where CreateRG.exe"` to find the exact path. – Charles Xu Sep 05 '18 at 05:36
  • It gives me this output "INFO: Could not find files for the given pattern(s). ". And i have kept my exe inside "C:\Scripts\CreateRG.exe" as i recreated the image. But it is not executing the exe – user1037747 Sep 05 '18 at 06:51
  • Use the command `cmd /c "dir C:"` to check if the directory Scripts exists and command `cmd /c "dir C:\Scripts"` to check if the CreateRG.exe exists. – Charles Xu Sep 05 '18 at 06:59
  • Yes both the scripts are working fine and both are showing me folder and exe exists. So why the exe is not executing ? – user1037747 Sep 05 '18 at 08:21
  • @user1037747 So I don't why you cannot find the CreateRG.exe with the command `cmd /c "where CreateRG.exe"`. – Charles Xu Sep 05 '18 at 08:30
0

It appears that you have mis-quoted your command to execute. Try:

cmd.exe /c "%AZ_BATCH_APP_PACKAGE_MyAppCreateRG%\CreateRG.exe -args HelloRG eastUs"
fpark
  • 2,304
  • 2
  • 14
  • 21
0

As an alternative i am able to execute powershell script instead of exe

powershell C:\Scripts\CreateRG.ps1 -resourceGroup "MyRG" -location "eastUs"

user1037747
  • 1,307
  • 2
  • 18
  • 38