"Press any key to continue..."의 두 판 사이의 차이

 
(같은 사용자의 중간 판 4개는 보이지 않습니다)
16번째 줄: 16번째 줄:
Console.Out.WriteLine("Press any key to continue...");
Console.Out.WriteLine("Press any key to continue...");
Console.ReadKey();
Console.ReadKey();
</syntaxhighlight>
==Java==
{{참고|자바 Press any key to continue...}}
<syntaxhighlight lang='java'>
import java.io.IOException;
public class Main {
    public static void main(String[] args) {
        pressAnyKeyToContinue();
    }
    private static void pressAnyKeyToContinue() {
        System.out.println("Press any key to continue...");
        try {
            new ProcessBuilder("cmd", "/c", "pause > null").inheritIO().start().waitFor();
        } catch (InterruptedException | IOException e) {
            e.printStackTrace();
        }
    }
}
</syntaxhighlight>
</syntaxhighlight>


22번째 줄: 43번째 줄:
echo 'Press any key to continue...';
echo 'Press any key to continue...';
fgetc(STDIN);
fgetc(STDIN);
</syntaxhighlight>
==PowerShell==
<syntaxhighlight lang='PowerShell'>
echo 'Press any key to continue...'
$null = [System.Console]::ReadKey()
</syntaxhighlight>
<syntaxhighlight lang='PowerShell'>
echo 'Press any key to continue...'
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
</syntaxhighlight>
</syntaxhighlight>



2021년 10월 16일 (토) 21:28 기준 최신판

Press any key to continue...
PAUSE

1 Bash[ | ]

read -sn 1 -p "Press any key to continue..."

2 CMD[ | ]

PAUSE

3 C#[ | ]

Console.Out.WriteLine("Press any key to continue...");
Console.ReadKey();

4 Java[ | ]

import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        pressAnyKeyToContinue();
    }

    private static void pressAnyKeyToContinue() {
        System.out.println("Press any key to continue...");
        try {
            new ProcessBuilder("cmd", "/c", "pause > null").inheritIO().start().waitFor();
        } catch (InterruptedException | IOException e) {
            e.printStackTrace();
        }
    }
}

5 PHP[ | ]

echo 'Press any key to continue...';
fgetc(STDIN);

6 PowerShell[ | ]

echo 'Press any key to continue...'
$null = [System.Console]::ReadKey()
echo 'Press any key to continue...'
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');

7 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}