The invention discloses a method for automatically and remotely executing a Windows program, mapping a local file directory to a server through a Windows remote desktop protocol channel, and executing a Windows program or a Windows built-in program in the mapped file directory; batch, automatic, and periodic login through a script The Windows server executes the target program and outputs the program execution result. The present invention creates a script for each task to log in to different Windows servers to execute the tasks in the script, and if the task needs to be changed, only the content of the script needs to be modified to quickly adapt to the change of task requirements and automatically execute the operation and maintenance operation , reduce manual interaction, improve the efficiency of operation and maintenance work, complete the operation and maintenance effect of the ideal Linux server, log in to the Windows server in batches, automatically, and periodically through scripts to execute the target program, and achieve the purpose of operation and maintenance.