Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Korean
  4. ShellExecute 사용 관련 문의
Forum Update on Monday, May 27th 2025

ShellExecute 사용 관련 문의

Scheduled Pinned Locked Moved Unsolved Korean
5 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hlowd
    wrote on last edited by
    #1

    안녕하세요.

    qt를 이용해서 코딩중에 궁금한 내용이 있어 문의드립니다.

    경로 : C:\Windows\System32\cmd.exe

    ShellExecute 를 이용해서 명령프롬포트 창을 실행하려고 합니다.
    경로에서 직접 실행 시 명령프롬포트 창이 팝업되고 scp 명령이 유효합니다.

    그런데 코드로 cmd 창을 실행하면 scp 명령이 유효하지 않고 cmd 창 색도 다릅니다.
    ShellExecute(NULL, TEXT("open"), TEXT("cmd.exe"), TEXT("/c scp"), NULL, SW_SHOW);

    코드로 scp 명령을 수행해야 하는데 해결 방법이 있을까요?
    ps) qprocess로 실행 시 scp 명령이 유효하지 않는 것 같습니다.

    C Pl45m4P 2 Replies Last reply
    0
    • H hlowd

      안녕하세요.

      qt를 이용해서 코딩중에 궁금한 내용이 있어 문의드립니다.

      경로 : C:\Windows\System32\cmd.exe

      ShellExecute 를 이용해서 명령프롬포트 창을 실행하려고 합니다.
      경로에서 직접 실행 시 명령프롬포트 창이 팝업되고 scp 명령이 유효합니다.

      그런데 코드로 cmd 창을 실행하면 scp 명령이 유효하지 않고 cmd 창 색도 다릅니다.
      ShellExecute(NULL, TEXT("open"), TEXT("cmd.exe"), TEXT("/c scp"), NULL, SW_SHOW);

      코드로 scp 명령을 수행해야 하는데 해결 방법이 있을까요?
      ps) qprocess로 실행 시 scp 명령이 유효하지 않는 것 같습니다.

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by ChrisW67
      #2

      I can only see what Google Translate shows me.

      ShellExecute() is a Windows API function and nothing to do with Qt or QProcess.

      If you want help with QProcess you should post the code you are trying to use.

      Google Translate:

      I would like to contact you if I have any questions while coding using QT.
      
      Path: C:\Windows\System32\cmd.exe
      
      I am trying to run a command prompt window using ShellExecute.
      When running directly from the path, a command prompt window pops up and the scp command is valid.
      
      But when I run the cmd window with the code, the scp command is not valid and the cmd window color is also different.
      ShellExecute(NULL, TEXT("open"), TEXT("cmd.exe"), TEXT("/c scp"), NULL, SW_SHOW);
      
      I need to execute the scp command in code. Is there a solution?
      ps) The scp command seems to be invalid when run with qprocess.
      
      H 1 Reply Last reply
      1
      • C ChrisW67

        I can only see what Google Translate shows me.

        ShellExecute() is a Windows API function and nothing to do with Qt or QProcess.

        If you want help with QProcess you should post the code you are trying to use.

        Google Translate:

        I would like to contact you if I have any questions while coding using QT.
        
        Path: C:\Windows\System32\cmd.exe
        
        I am trying to run a command prompt window using ShellExecute.
        When running directly from the path, a command prompt window pops up and the scp command is valid.
        
        But when I run the cmd window with the code, the scp command is not valid and the cmd window color is also different.
        ShellExecute(NULL, TEXT("open"), TEXT("cmd.exe"), TEXT("/c scp"), NULL, SW_SHOW);
        
        I need to execute the scp command in code. Is there a solution?
        ps) The scp command seems to be invalid when run with qprocess.
        
        H Offline
        H Offline
        hlowd
        wrote on last edited by
        #3

        @ChrisW67

        cmd.exe가 존재하는 경로에서 직접 exe 실행 시 scp 명령어가 유효합니다.

        다만 아래 코드를 통해 cmd.exe를 열고 scp를 입력 시 명령이 유효하지 않습니다.

        코드입니다.

        ShellExecuteA(NULL, "open", "cmd.exe", "/c scp", "C:\\", SW_SHOWNORMAL);
        
        C 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher moved this topic from General and Desktop on
        • H hlowd

          @ChrisW67

          cmd.exe가 존재하는 경로에서 직접 exe 실행 시 scp 명령어가 유효합니다.

          다만 아래 코드를 통해 cmd.exe를 열고 scp를 입력 시 명령이 유효하지 않습니다.

          코드입니다.

          ShellExecuteA(NULL, "open", "cmd.exe", "/c scp", "C:\\", SW_SHOWNORMAL);
          
          C Offline
          C Offline
          ChrisW67
          wrote on last edited by
          #4

          @hlowd You use ShellExecute when you have a file and want to launch the associated application, e.g. Open whatever is configured to handle PNG files by giving ShellExecute the PNG file. If you want to use a Windows API call to launch an executable then you should be looking at CreateProcess or a related function.

          1 Reply Last reply
          0
          • H hlowd

            안녕하세요.

            qt를 이용해서 코딩중에 궁금한 내용이 있어 문의드립니다.

            경로 : C:\Windows\System32\cmd.exe

            ShellExecute 를 이용해서 명령프롬포트 창을 실행하려고 합니다.
            경로에서 직접 실행 시 명령프롬포트 창이 팝업되고 scp 명령이 유효합니다.

            그런데 코드로 cmd 창을 실행하면 scp 명령이 유효하지 않고 cmd 창 색도 다릅니다.
            ShellExecute(NULL, TEXT("open"), TEXT("cmd.exe"), TEXT("/c scp"), NULL, SW_SHOW);

            코드로 scp 명령을 수행해야 하는데 해결 방법이 있을까요?
            ps) qprocess로 실행 시 scp 명령이 유효하지 않는 것 같습니다.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #5

            @hlowd said in ShellExecute 사용 관련 문의:

            코드로 scp 명령을 수행해야 하는데 해결 방법이 있을까요?
            ps) qprocess로 실행 시 scp 명령이 유효하지 않는 것 같습니다.

            I need to run the scp command with the code, is there any workaround?
            P.S. The scp command doesn't seem to be valid when executed with qprocess.

            (translated with DeepL)

            If you want to start a QProcess and run scp do something like this:

                QProcess process;
               // Path to your scp, wherever it is...
               // e.g. C:/Windows/System32/OpenSSH/scp.exe
                QString command = "C:/Program Files/Git/usr/bin/scp.exe"; // you need full path to scp.exe here
                            // or register in PATH variable on your system so that Windows knows the "scp" command and where the program is located
                QStringList params;
                params.append("‪/C/Path/to/File");
                params.append("‪user@host:/C/Destination/Path/");
                process.start(command, params, QIODevice::ReadWrite);
            

            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • Pl45m4P Pl45m4 referenced this topic on

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved