简体   繁体   中英

How do I create a powershell script for windows that runs 2 python scripts

This is the first time I tried doing a shell script.

So this is what I got for now:

$pdf = read-host "enter the pdf name"

cmd /k C:\the path\\./PDF_ID.py  $pdf /all> C:\the path\data.txt 

C:\the path\pdf.py 

So the first python script is executed and it saves the output to the data.txt but I dont know how to run the second python script that analyzes data.txt and outputs if the pdf file contains malware or not.

If you are able to run Python from Powershell, then python <scriptName>.py will get your job done.

You can give the full path of the Python executable within the command line (incase not working). You could check and ensure that your python executable path is available in your system variables.

If you are not looking from any concurrent solution, then directly put these two inside your samplePS1 file:

python firstscript.py ;
python secondscript.py  ;

Note: If you want to pass arguments , then you can pass the arguments also. This is a sequential execution.

Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM