run .bat file on remote machine - python

I try to run .bat file on remote machine.
From my machine i mapped the folder where my .bat (on the remote machine) is exist and from my machine i just try to run the file:
os.system(r'‪Y:\file.bat')
But it seems that nothing hapenning.
Any suggestions ?
BTW both machines are Windows

Related

Installing Python on a fresh new computer using a python script from another one?

So, for example, I have two Windows PCs that are not connected to same network.
Let's name them Computer 1 and Computer 2.
Computer 2 already has python installed in it and Computer 1 is brand new
I want to be able to install python environment on Computer 1 using the .exe file that we can get from python.org while sitting at Computer 2
Suppose Computer 1 has a .exe file that it received from me. When that exe is run, I want it to install python in their PC
You will need a way to transfer the file form local machine to remote.
Execute a script on remote machine.
On Linux, you can use scp for step 1
scp local_python_file_or_script.sh remote-user#remote_machine_ip:/path_on_remote/
After this you can use ssh to execute the script on remote machine
ssh user#remote_machine_ip /path_on_remote/local_python_file_or_script.sh
PS. If the file is not executable on remote machine, you will need to use ssh and change chmod +x
PS2. You will need to find the equivalent for these tools on windows.

best/simple way to run .bat file on remote machine

I have another machine on the same network, from my machine I can reach this remote machine (both are Windows).
On the remote machine I have .bet file that start some service.
What is the simplest way to reach this .bat file and run this file on the remote machine?

Jupyter Notebook: Execution on Remote Server: are Files Written to Remote Server?

I want to execute a Jupyter Notebook on a remote server.
If I use this:
with open('somefile.txt', 'a') as the_file:
the_file.write('Hello\n')
Is the file saved on the local or the remote file system?
Yes, the file will be saved into the remote file system. You can make use of applications like Filezilla if you are using Linux OS or you can use Winscp for windows to retrieve the files.

Copy File from Windows Host to Linux [Python]

What are the different modules/ways to copy file from a windows computer to a linux server available in python
I tried using ftplib api to connect to the windows server but i m unable to do with the error - socket.error: [Errno 111] Connection refused
What are the other modules that i can connect to a windows computer to copy or list the files under a directory
If you have access to linux server, and the file generated on windows automatically, you can do the folowing:
Generate ssh-key on your windows maching
Add it to authorized_hosts of the linux machine
Install simple console scp tool on windows
Write simple cmd-script to copy file with help of scp, something like:
scp c:\path\to\file.txt user#linuxhost.local:/home/user/file.txt
Run this script automatically every time, then the file is generated on windows host.

Transfer file from local machine to remote windows server using python

How can I easily copy a local file to a remote server using python?
I don't want to map the drive to my local machine and the windows server requires a username and password.
The local machine is also a windows machine.
Examples I've seen are with linux and mapping the drive. Unfortunately that's not an option for me.
You can use the subprocess module or os.system to launch a command into a windows shell. Then you can use Powershell or cmd instructions.

Categories

Resources