How to run a batch file without connecting to virtual machine?

NP Data 0 Reputation points
2024-07-24T20:32:10.7066667+00:00

Hi All,

I have a batch file within azure virtual machine. When I'm connected to the VM using RDP I can use a task scheduler to run the batch file.
(For context, the .bat file runs various python and R files)

I want this batch file to run without user intervention. Let's say I'm not connected to the VM nor I am using my local system. Is there a way I can schedule this .bat file to run inside VM?
Also, after the batch file runs all the latest files are sync'd to Dropbox

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,661 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,572 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,994 questions
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,195 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 103.9K Reputation points MVP
    2024-07-24T20:44:58.2666667+00:00

    Hi @NP Data ,

    to run a script inside an Azure VM you can use the Run command in Azure Portal: Azure Portal - Run command

    Or use Azure CLI: Azure CLI - Run command

    Or use PowerShell: PowerShell - Run command


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten


  2. Bruce (SqlWork.com) 61,491 Reputation points
    2024-07-24T21:07:53.43+00:00

    you don't give the O/S of the vm. for windows you can use the task scheduler:

    https://learn.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-start-page

    note: if you installed desktop experience you can use the task scheduler app otherwise use command line schtasks.