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

48번째 줄: 48번째 줄:
<syntaxhighlight lang='PowerShell'>
<syntaxhighlight lang='PowerShell'>
echo 'Press any key to continue...'
echo 'Press any key to continue...'
Write-Host -Object ('' -f [System.Console]::ReadKey().Key.ToString());
[System.Console]::ReadKey().Key.ToString() >$null
</syntaxhighlight>
</syntaxhighlight>



2021년 10월 16일 (토) 21:26 판

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...'
[System.Console]::ReadKey().Key.ToString() >$null

7 같이 보기

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