Program's/CMD
-
[CMD] setlocal & endlocalProgram's/CMD 2023. 7. 6. 15:03
안녕하세요. 아야87입니다. CMD 명령어 중 setlocal, endlocal에 대해 알아보겠습니다. SETLOCAL, ENDLOCAL setlocal 및 endlocal은 환경 변수를 지역화하는 데 사용되는 명령입니다. setlocal 명령을 사용하면 일괄 처리 파일 내에서만 환경 변수를 변경할 수 있으며, endlocal 명령을 사용하면 변경된 환경 변수를 원래 상태로 복원합니다. setlocal endlocal 다음은 SETLOCAL, ENDLOCAL 명령어의 기본 사용법입니다. @echo off echo setlocal 사용 전, a 변수 정의 set a=1 echo. echo setlocal 실행 setlocal echo. echo setlocal 사용 후, b 변수 정의 set b=2 ech..
-
[CMD] GOTO 명령 / 레이블(Label) 에 대해서Program's/CMD 2023. 6. 16. 16:34
안녕하세요. 아야87입니다. CMD 명령어 중 GOTO 사용법과 레이블(Label)에 대해 알아보겠습니다. GOTO GOTO 명령은 레이블을 지정한 곳으로 이동하는 데 사용됩니다. 레이블(label) GOTO가 지정한 곳의 목적지입니다. 어떤 문자열 앞에 콜론(:)으로 정의를 해주면, GOTO 문의 지정한 목적지로 이동합니다. 레이블은 대소문자 구분하지 않습니다. goto 레이블 :레이블 ex) goto run :run 다음은 GOTO 명령어의 기본 사용법입니다. @echo off goto RUN echo 이 문장은 절대로 실행 되지 않습니다. :RUN echo 레이블 RUN에 입장하였습니다. echo 종료하겠습니다. 결과 레이블 RUN에 입장하였습니다. 종료하겠습니다. goto RUN 다음 명령인 "e..
-
[CMD] ECHO(출력, echo off, echo on, @)Program's/CMD 2023. 6. 7. 15:28
안녕하세요. 아야87입니다. CMD명령어 중 ECHO(에코)와 옵션 사용법에 대해 알아보겠습니다 ECHO ECHO 명령어는 명령 프롬프트에서 문자열을 출력하는 데 사용되는 명령입니다. echo "문자열" 예를 들어, "Hello World"라는 문자열을 출력하려면 다음과 같은 명령어를 사용합니다. @echo off echo Hello World 결과 Hello World ECHO ON / OFF 코드 첫 줄에 항상 '@echo off' 가 있었습니다. '@echo off'가 무엇이지?? 궁금하신분들이 있었을텐데... 지금부터 알아보도록 하겠습니다. 명령의 출력을 켜거나 끄는 데 사용하는 옵션이 echo on, echo off 입니다. ON으로 설정하면 명령 프롬프트에서 명령의 출력이 표시되며, OFF로 ..
-
[CMD] SET 명령어 변수 (사칙연산, 사용자입력후 출력, 변수 삭제)Program's/CMD 2023. 6. 7. 14:20
안녕하세요. 아야87입니다. CMD명령어 중 SET으로 사직연산과 사용자 입력 값을 수행하는 방법에 대해 알아보겠습니다. 사칙연산은 덧셈, 뺄셈, 곱셈, 나눗셈의 네 가지 기본 연산을 말합니다. 배치 파일 내에서 사칙연산이 필요한 경우, SET 명령에 /a 옵션을 붙이면 사칙연산을 계산 가능합니다. /a 옵션은 변수에 정수를 설정하는 데 사용됩니다. 사용자에게 입력을 받고 변수에 할당 후, 출력을 해야 할 경우, SET명령에 /p 옵션을 붙이면 됩니다. 변수를 삭제해야 할 경우, 값을 공백으로 입력하면 됩니다. SET 옵션 2가지와 변수 삭제에 대해 알아보도록 하겠습니다. 사칙연산(덧셈, 뺄셈, 곱셈, 나눗셈) 기본 사용법은 다음과 같습니다. set /a 변수=계산식 아래의 코드로 입력해서 출력을 해보겠..
-
[CMD] SET 환경 변수 설정Program's/CMD 2023. 5. 23. 11:48
안녕하세요. 아야87입니다. SET 명령은 현재 등록된 환경변수(시스템, 사용자 변수) 목록을 본다거나 변수 생성, 수정 및 제거하는 데 사용됩니다. 변수는 명령 프롬프트에서 입력해야 하는 긴 명령 줄을 반복적으로 사용해야 하는 변수 사용에 유용합니다. 예를 들어, "C:\Windows\System32\cmd.exe"를 실행하려면 긴 명령을 입력해야 합니다. 그러나 'run_cmd'라는 변수를 만들어 "set run_cmd=C:\Windows\System32\cmd.exe" 명령을 실행한 후, run_cmd 변수만 사용하여 cmd.exe를 실행할 수 있습니다. 그럼 SET 명령의 사용법에 대해 알아보도록 하겠습니다. 환경 변수 목록 보기 아래의 코드대로 Visual Studio Code 또는 명령 프롬프..
-
[CMD] 배치파일을 Visual Studio Code에서 실행Program's/CMD 2023. 5. 22. 15:23
안녕하세요. 아야87입니다. 배치(batch) 파일은 명령 프롬프트에서 명령을 실행하는 데 사용할 수 있는 스크립트이며, 반복적으로 반복되는 작업을 자동화하는 데 사용됩니다. 본문 내용을 보기 전에 아래의 링크를 보시고 Visual Studio Code, Extenstion batch Runner를 설치해주시기 바랍니다. VS CODE 설치 방법은 아래를 참조해 주세요~~ [01] Visual Studio Code 설치 방법 안녕하세요. 아야87입니다. Visual Studio Code는 MicroSoft에서 오픈소스로 개발한 소스 코드 편집기입니다. 웹 개발, 인공 지능 및 기계 학습, 데이터 과학을 포함한 다양한 프로그래밍 언어를 지원합 ayastory.tistory.com VS CODE 설치 후 배..
-
[CMD] 배치(batch)파일이란?? 생성?? 실행??Program's/CMD 2023. 5. 21. 12:00
안녕하세요. 아야87입니다. 배치(batch) 파일?? 배치(batch) 파일은 명령 프롬프트에서 명령을 실행하는 데 사용할 수 있는 스크립트입니다. '.bat', '.cmd' 파일 확장자로 저장되며, 여러 명령을 실행하는 데 유용한 도구입니다. 명령을 한 번에 하나씩 입력하는 대신 배치 파일을 실행하여 시간을 절약할 수 있습니다. 배치 파일은 작업을 자동화하는 데에도 사용할 수 있습니다. 배치(batch) 파일 생성 및 실행 새 배치 파일을 만들려면 메모장이나 워드패드 같은 텍스트 편집기로 생성할 수 있습니다. 1. 메모장(notepad) 실행 2. 내용 작성 @echo off rem 디렉토리 생성 mkdir C:\batch_test rem 텍스트 파일 생성, 내용은 Create batch file. ..
-
[CMD] CMD, 명령 프롬프트(Command Prompt) 명령어 모음Program's/CMD 2023. 5. 20. 12:00
안녕하세요. 아야87입니다. 이번 포스팅에서는 여러 CMD 명령어중 아야87이 가장 많이 사용 했던 명령어가 무엇인지 간략하게 알아보겠습니다. set: 환경 변수를 설정하고 조작 if: 조건이 참인지 거짓인지 확인 for: 값에 대해 명령을 반복적으로 실행 echo: 명령줄 인터페이스에서 텍스트를 출력 setlocal: 환경 변수의 새 범위를 시작 endlocal: 환경 변수의 새 범위를 종료 mkdir: 새 디렉토리(폴더) 생성 rmdir: 디렉토리(폴더) 삭제 copy: 디렉토리(폴더) 복사 del: 디렉토리(폴더) 삭제 ren: 파일 또는 디렉토리(폴더)의 이름을 변경 ipconfig: 네트워크 인터페이스 구성을 표시 findstr: 파일에서 텍스트의 패턴을 검색 msiexe: Windows Ins..