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