I needed to remotely update website content from my Windows machine at home, and while I have Conda installed on Windows, I found I couldn’t directly write and run scripts. I could only launch Conda from the Start menu and type commands line by line.

After some searching and learning, I finally found a solution.

The reason you can’t directly write and run .bat batch files for Conda commands (which use various Python libraries from Conda) is that the default cmd.exe doesn’t activate the Conda environment. Once you add the environment activation command, your scripts will run. You can refer to the original English explanation here: https://stackoverflow.com/questions/46305569/how-to-make-batch-files-run-in-anaconda-prompt.

The final command structure looks like this:

call 'G:/conda/Scripts/activate.bat' 
scrapy crawl dou
python tupian.py
python post.py