Running batch file from webserver - windows

I have a web server that only I use running on my windows machine, and I would like it to run a batch file that's on the web server when I click a button on the website. Is this possible?
To reiterate:
Click button -> website runs batch file on same machine as webserver

Here's a lightweight webserver example in python: http://www.acmesystems.it/python_httpd
And running the batch file + getting the output: Run a .bat file using python code

Related

run batch script after windows server restart

I am trying to run a script to startup some services after windows reboot.
I have tried one method: copying shortcuts of batch script in shell:startup folder. which eventually will start the scripts automatically but someone has to login to the system.
I am thinking about the possible ways to run the script after server restart without logon to the server.
Any help will be highly appreciated.
Create a Windows scheduled task and set it to run on system startup:

Start local meteor app after windows boot

A local meteor (1.2) application should get started in the background right after windows has been booted. What are my options to get the job done?
You can use the following steps, if you want to start Meteor automatically when a user logs in:
Create a batch file.
Open the newly created batch file and place the following lines into it:
#echo off
cd "<the path to your Meteor project>"
meteor
timeout /t 10
start "C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe" http://localhost:3000
Create a shortcut:
Open the Run window (Win + R).
Open shell:startup (or go to: C:\Users\John Doe\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup).
Copy the shortcut into the folder.
Now, when a user logs in, Meteor should start your project and Microsoft Edge should open http://localhost:3000 after 10 seconds.
Applications cannot run without a user being logged in. So "started in the background right after windows has been booted" is not something that is going to happen. You would need a service for that, and services are not interactive. Assuming that you're talking about the Meteor JS framework, you can't build a service out of that.
If you're talking about starting an application when a user logs in, then you can do that easily by adding a shortcut to the executable to the user's "Startup" folder. On modern versions of Windows, the path would be something like:
C:\Users\UserName\AppData\Local\Microsoft\Windows\Start Menu\Programs\Startup

Execute exe-file over ssh from Jenkins

I'm having a issue with CI where after i deployed a build i can't get the new version to start. In Jenkins the console output just keeps spinning when it hit the part of the batch file to start the exe-file and then times out.
I have tried both to run it inside the batch file and from the SSH command line but i can't get it to start on our Windows server.
Any suggestions?

How to see opened cmd running at batch script when it is scheduled to run using windows scheduler

I've written batch script and added that in windows scheduler service.
It runs fine and I can access my deployed app which I'm deploying using that service but I want command promote to get open and see that command running when that service is in progress.
How to do that?

Batch script to update hosts file on boot-up using curl

I am trying to get a .bat script to run on boot-up and purge the hosts file with a new one.
I have this working on Windows Server 2008 Standard X86 and it has been working consistently for over a year. I installed 'curl', hard linked it to System32 and schedule the following .bat script using local group policy:
curl x.x.x.x/latest/hosts > C:\Windows\System32\drivers\etc\hosts
Now I want to get the same script working on windows server 2008 R2. I have the same thing setup and it works if I double-click the .bat file. However, when the script runs on startup via GPO, it simply wipes the hosts file completely and I have to login manually and double-click the .bat script.
Any idea what's causing this?
Is it a difference between Server 2008 R2 and Server 2008 STD?
Try
curl.exe x.x.x.x/latest/hosts > C:\Windows\System32\drivers\etc\hosts.tmp
move C:\Windows\System32\drivers\etc\hosts.tmp C:\Windows\System32\drivers\etc\hosts

Resources