jm_p_op

레지스토리 - html에서 내부 프로그램 실행 본문

코딩/개인질문들

레지스토리 - html에서 내부 프로그램 실행

jm_p_op 2025. 9. 19. 17:31

ctrl + R - regedit

1. key생성

jmtest(앱이름) - shell - open - command

jmpop에 문자열 값 추가 "URL Protocol"

command의 데이터 값 수정
"C:\Users\user\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\user\Desktop\projects\work\greedServer\hello.py" "%1"

=> exe / 절대경로에 있는 hello.py 실행 / 인자값 받을께

 


실행 py

import json
import os
import sys

data = {
    "message": "Hello, world!",
    "status": "success",
    "cwd": os.getcwd(),
    "input": sys.argv
}

with open(r"C:\Users\user\Desktop\projects\work\greedServer\example.json", "w", encoding="utf-8") as f:
    json.dump(data, f, ensure_ascii=False, indent=4)
output_path = os.path.join(os.getcwd(), "example.json")
with open(output_path, "w", encoding="utf-8") as f:
    json.dump(data, f, ensure_ascii=False, indent=4)

{앱이름}:// 링크로 접속
jmtest://test0/test1;test2의 결과 

{
    "message": "Hello, world!",
    "status": "success",
    "cwd": "C:\\WINDOWS\\system32",
    "input": [
        "C:\\Users\\user\\Desktop\\projects\\work\\greedServer\\hello.py",
        "jmtest://test0/test1;test2"
    ]
}

 


결론
system32에서 실행된다.
절대 경로로 저장하는것은 성공
system32에서 저장되는것은 실패(아마 권한 문제로 추정)

'코딩 > 개인질문들' 카테고리의 다른 글

matlab같은 공간할당을 통한 시간 절약가능성  (0) 2023.05.06
django- save  (0) 2023.04.14
django,form,html  (0) 2023.04.13