Python

Etc

vbs이용, 검은창 (command창) 없이 python 실행

홍사훈     0건     416회

본문

## 메모장에 다음을 작성하고 test.vbs 파일로 저장

 

Option Explicit Dim WshShell, strPythonExe384, strPythonExe394, strScriptPath, objFSO

Set WshShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") strPythonExe384 = "C:\python-3.8.4\python.exe" strPythonExe394 = "C:\python-3.9.4\python.exe" strScriptPath = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")) & "pythontest.py" If objFSO.FileExists(strPythonExe) Then WshShell.Run """" & strPythonExe384 & """ """ & strScriptPath & """", 0, False Else ' WshShell.Popup "파일을 찾지 못함", 5, "오류", vbExclamation WshShell.Run """" & strPythonExe394 & """ """ & strScriptPath & """", 0, False End If


등록된 댓글이 없습니다.



Copyrightⓡ1996~2025, sahoon.com All Rights Reserved.