no classification
no tag
no datas
posted on 2024-12-02 22:09 read(974) comment(0) like(25) collect(4)
I want to run a Python script in cmd when a button is clicked in VB.Net. Do you need to call the Python script in a batch file? Or can you do it directly in VB?
I tried this
Dim ps As New ProcessStartInfo("cmd.exe")
ps.Arguments = "C:\yourbatfile.bat"
Process.Start(ps)
But that only opens the cmd window and doesn't execute the bat file.
Dim psi = New ProcessStartInfo("c:\python27\python.exe", "myPythonScript.py")
Dim proc = Process.Start(psi)
proc.WaitForExit()
If proc.ExitCode <> 0 then throw new Exception(" Script Failed")
Author:qs
link:http://www.pythonblackhole.com/blog/article/247240/849c5cbf01376f796d59/
source:python black hole net
Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.
name:
Comment content: (supports up to 255 characters)
Copyright © 2018-2021 python black hole network All Rights Reserved All rights reserved, and all rights reserved.京ICP备18063182号-7
For complaints and reports, and advertising cooperation, please contact vgs_info@163.com or QQ3083709327
Disclaimer: All articles on the website are uploaded by users and are only for readers' learning and communication use, and commercial use is prohibited. If the article involves pornography, reactionary, infringement and other illegal information, please report it to us and we will delete it immediately after verification!