[CMD][FTP]

etc 2015. 3. 9. 16:57

C:\>ftp

ftp> open [ip] [port]

[ip]에 연결되었습니다.

220 Microsoft FTP Service

사용자([ip]:(none)): [id]

331 Password required for [id].

암호:

230 User [id] logged in.

ftp> quit

221


C:\>

'etc' 카테고리의 다른 글

윈도우 2003서버에서 작업스케줄러가 작동하지 않는다.  (0) 2015.01.30
DIR vs PATH  (0) 2015.01.28
WDK 샘플 설치 삽질기  (0) 2013.07.28
ADO 문제(오류번호: 80004003)  (0) 2012.07.10
FTP vs HTTP  (0) 2011.04.14
블로그 이미지

란마12

,

어느날 부터인가 백업용 작업스케줄러가 작동하지 않는다.

탐색기에서 C:\WINDOWS\Tasks에 들어가보면 메뉴에 고급->로그 보기


"backup.job" (06_job) 2015-01-30 오후 10:43:25 ** 오류 **

작업을 시작할 수 없습니다..

특정 오류:

0x80070005: 액세스가 거부되었습니다.

[작업 페이지 찾기] 단추를 사용하여 응용 프로그램을 찾으십시오..


스케줄러에 등록된 스크립트파일 경로와 파일명은 정확했지만 경로에 공백이 들어가서 문제

'etc' 카테고리의 다른 글

[CMD][FTP]  (0) 2015.03.09
DIR vs PATH  (0) 2015.01.28
WDK 샘플 설치 삽질기  (0) 2013.07.28
ADO 문제(오류번호: 80004003)  (0) 2012.07.10
FTP vs HTTP  (0) 2011.04.14
블로그 이미지

란마12

,

DIR vs PATH

etc 2015. 1. 28. 09:44

Directory: A term that has the same basic meaning as folder, but predates the graphical folder concept and does not generally support virtual locations. (Alternate definition: A directory is a folder.)

폴더와 같은 의미, 그러나 UI로 보이는 폴더보다는 앞선 개념이고 가상 위치로 쓰이지 않는다.(디렉토리는 폴더다.)

Path: This term is descriptive in that it represents a type of "road map" to a specific file or directory. (Alternate definition: A path is a list, beginning with a drive letter, that tells which folders to open so that you can find a file or another folder.)

파일이나 폴더를 표현하기 위한 "로드맵"(드라이브 문자로 시작하고 파일이나 다른 폴더를 찾을 수 있는 폴더들의 목록)

Command Prompt window

Using both of these terms and looking at the Command Prompt picture above, if you opened a Windows Explorer folder window (directory) and wanted to get to example.docx that was saved in the Users directory, you would start at Local Disk C, then you would open the Users directory and find example.docx inside. The entire path to the file would be:

이 두가지 개념으로 위의 그림을 살펴보면, 탐색기에서 Users 디렉토리에 저장되어 있는  example.docx 파일을 찾고싶다면, C 드라이브 밑에 있는 Users 디렉토리를 열고 그 안에 있는 example.docx를 찾을 수 있다. 전체 PATH는 아래와 같다:

C:\Users\example.docx

'etc' 카테고리의 다른 글

[CMD][FTP]  (0) 2015.03.09
윈도우 2003서버에서 작업스케줄러가 작동하지 않는다.  (0) 2015.01.30
WDK 샘플 설치 삽질기  (0) 2013.07.28
ADO 문제(오류번호: 80004003)  (0) 2012.07.10
FTP vs HTTP  (0) 2011.04.14
블로그 이미지

란마12

,

WDK 샘플 설치 삽질기

etc 2013. 7. 28. 16:18

1. WIN7 64 인데 32용으로 컴파일/설치

 1) 프린터 드라이버 삭제

  가. windows폴더 아래 bitmap.dll파일 위치 검색

   가) C:\Windows\System32\DriverStore\FileRepository\bitmap.inf_amd64_neutral_d515dd8cf86fffaa\bitmap\amd64

   나) C:\Windows\System32\spool\drivers\x64\3

   다) 가)항은 수동삭제, 나)항은 권한문제로 삭제되지 않아 http://technet.microsoft.com/en-us/library/cc730875.aspx 참조하여 삭제

        pnputil.exe -e로 검색 

-----------------------------------------------------

게시된 이름 :            oem92.inf

드라이버 패키지 공급자 :   Microsoft WDK Sample

클래스 :                     프린터

드라이버 날짜 및 버전 :   6/07/2001 1.0.0.1

서명자 이름 :

------------------------------------------------------


공급자가 Microsoft WDK Sample로 검색되는 드라이버 모두 삭제


        pnputil.exe -d Oem92.inf 삭제


드라이버 설치 시 마지막 단계에서 기존 설치된 드라이버 사용하겠냐는 메시지

bitmap.inf_amd64_neutral_d515dd8cf86fffaa.cab

'etc' 카테고리의 다른 글

윈도우 2003서버에서 작업스케줄러가 작동하지 않는다.  (0) 2015.01.30
DIR vs PATH  (0) 2015.01.28
ADO 문제(오류번호: 80004003)  (0) 2012.07.10
FTP vs HTTP  (0) 2011.04.14
파일날짜 변경 시점  (0) 2010.07.09
블로그 이미지

란마12

,

7에서 컴파일 한 프로그램이 xp에서 mdb파일을 열지 못하는 문제 발생.

7 sp1이후 ADO관련 모듈에 변화가 생겨 하위호환성이 깨진듯 하다.(http://support.microsoft.com/kb/2640696)

업데이트 셋업파일을 받아야 하는데 윈도우가 정품이 아니라 받지 못했다. -_-;

다행히 수동으로 하는 방법이 있었다.


  • Msado60_Backcompat_i386.tlb (http://download.microsoft.com/download/6/4/3/64318ED2-7E18-4A5C-80E2-9BDA0DF02DB3/msado60_Backcompat_i386.tlb)
  • msado60_Backcompat_i386.tlb

  • 일단은 32bit만 한다 64비트도 있다

    일단 C:\Program Files\Common Files\System\ado에 다운 받는다.


    커멘드창을 실행하고  

    C:\Program Files\Common Files\System\ado>  이렇게 실행 위치를 바꾸고

    %windir%\Microsoft.NET\Framework\v4.0.30319\regtlibv12 msado60_Backcompat_i386.tlb


    그럼 바로 요런 메세지가 뜰것이다

    Registration of msado60_Backcompat_i386.tlb successful.

     

    그렇다면 레지스트

    리를 확인해보자

    HKEY_CLASSES_ROOT\TypeLib\{0C0FF45D-87C8-4333-9075-3D9B4D64F9FC}\6.0\0\win32

     

    데이터위치가

    C:\Program Files\Common Files\System\ado\msado60_Backcompat_i386.tlb 이렇게 되어있는지 확인한다.

     

    여기까지 됐다면 당신은 성공한것이다 그럼 계속 아래 글대로 따라해보기 바란다.

     

    stdafx.h에서 바꾸란다.

    #import! "msado15.dll" no_namespace rename("EOF","EndOfFile")요런걸

    #import! "msado60_Backcompat.tlb" no_namespace rename("EOF","EndOfFile")게 바꾸란다 


    Msado60_Backcompat_i386.tlb 파일을

    비쥬얼 스튜디오에 추가시킨다


    //#import! "c:\program files\common files\system\ado\msado15.dll" rename ("EOF","adoEOF") no_namespace
    #import! "C:/Program Files/Common Files/System/ado/msado60_Backcompat_i386.tlb" no_namespace rename("EOF","EndOfFile")

    그리고 나는 이렇게 바꿨다.

     



     그랬더니 빌드가 되면서 에러가 뜬다.

     

    _RecordsetPtr 에 멤버 변수가 바꿨다고 에러가 뜬다

     

    adoEOF---->> EndOfFile 로 바꿨다고 나온다

    이렇게 하고 빌드했더니 이제 잘된다..


    출처: http://blog.daum.net/cjp777/1

    'etc' 카테고리의 다른 글

    DIR vs PATH  (0) 2015.01.28
    WDK 샘플 설치 삽질기  (0) 2013.07.28
    FTP vs HTTP  (0) 2011.04.14
    파일날짜 변경 시점  (0) 2010.07.09
    MSComm32.ocx 라이센스 등록  (0) 2010.06.18
    블로그 이미지

    란마12

    ,

    FTP vs HTTP

    etc 2011. 4. 14. 12:13

    This is my attempt to document the primary differences between FTP and HTTP, as this is commonly asked and also a lot of misconceptions (and outright lies) are flying around. If you find any errors, or have additional stuff to add, please mail me!

    Both protocols are used for uploads and downloads on the internet, for text and for binary, both over TCP/IP. But there are a lot of differences in the details:

    Transfer Speed

    Possibly the most common question: which is faster for transfers?

    Given all details on this page. What makes FTP faster:

    • No added meta-data in the sent files, just the raw binary
    • Never chunked encoding "overhead"

    What makes HTTP faster:

    • reusing existing persistent connections make better TCP performance
    • pipelining makes asking for multiple files from the same server faster
    • (automatic) compression makes less data get sent
    • no command/response flow minimizes extra round-trips

    Ultimately the net outcome of course differ depending on specific details, but I would say that for single-shot static files, you won't be able to measure a difference. For a single shot small file, you might get it faster with FTP (unless the server is at a long round-trip distance). When getting multiple files, HTTP should be the faster one.

    Age

    FTP (RFC 959) appeared roughly ten years before HTTP was invented. FTP was the one and only protocol back then. The initial traces of what become RFC 959 can be found already as early as 1971 (RFC 114)

    Upload

    Both protocols offer uploads. FTP has an "append" command, where HTTP is more of a "here's data coming now you deal with it" approach.

    It could be worth noticing that WebDAV is a protocol on top of HTTP that provides "filesystem-like" abilities

    ASCII/binary/EBCDIC

    FTP has a notion of file format so it can transfer data as ASCII or binary (and more) where HTTP always sends things binary. FTP thus also allows text conversions when files are sent between systems of different sorts:

    If the destination uses a different scheme for encoding End-Of-Line characters ftp will correct it for the destination. For example unix uses only a NL (newLine x'0A') character and MS windows uses CR and LF (CarriageReturn and LineFeed x'0D0A'). MS windows includes a CTRL-Z (x'1A') as an end of file character, unix does not. EBCDIC specifies that a translation be performed from ASCII to EBCDIC (used on old mainframes).

    HTTP provides meta-data with files, Content-Type, which clients use but FTP has no such thing. The meta data can thus be used by clients to interpret the contents accordingly.

    Headers

    Transfers with HTTP always also include a set of headers that send meta data. FTP does not send such headers. When sending small files, the headers can be a significant part of the amount of actual data transfered. HTTP headers contain info about things such as last modified date, character encoding, server name and version and more.

    Pipelining

    HTTP supports pipelining. It means that a client can ask for the next transfer already before the previous one has ended, which thus allows multiple documents to get sent without a round-trip delay between the documents, and TCP packets are thus optimized for transfer speed.

    Something related, although not similar, is FTP's support for requesting multiple files to get transferred in parallel using the same control connection. That's of course using new TCP connections for each transfer so it'll get different performance metrics.

    FTP Command/Response

    FTP involves the client sending commands to which the server responds. A single transfer can involve quite a series of commands. This of course has a negative impact since there's a round-trip delay for each command. HTTP transfers are primarily just one request and one response (for each document). Retrieving a single FTP file can easily get up to 10 round-trips.

    Two Connections

    One of the biggest hurdles about FTP in real life is its use of two connections. It uses a first primary connection to send control commands on, and when it sends or receives data, it opens a second TCP stream for that purpose.

    Firewalls and NATs

    FTP's use of two connections, where the second one use dynamic port numbers and can go in either direction, gives the firewall admins grief and firewalls really have to "understand" FTP at the application protocol layer to work really well.

    This also means that if both parties are behind NATs, you cannot use FTP!

    Additionally, as NATs often are setup to kill idle connections and the nature of FTP makes the control channel remain quiet during long and slow FTP transfers, we often end up with the control channel getting cut off by the NAT due to idleness.

    Active and Passive

    FTP opens the second connection in an active or passive mode, which basically says which end that initiates it. It's a client decision to try either way.

    Encrypted Control Connections

    Since firewalls need to understand FTP to be able to open ports for the secondary connection etc, there's a huge problem with encrypted FTP (FTP-SSL or FTPS) since then the control connection is sent encrypted and the firewall(s) cannot interpret the commands that deal with creating the second connection. Also, the FTPS standard took a very long time to "hit it" so there exists a range of hybrid versions out in the wild.

    Authentications

    FTP and HTTP have a different set of authentication methods documented. While both protocols offer basically plain-text user and password by default, there are several commonly used authentication methods for HTTP that isn't sending the password as plain text, but there aren't as many (non-kerberos) options available for FTP.

    Download

    Both protocols offer support for download. Both protocols used to have problems with file sizes larger than 2GB but those are history for modern clients and servers on modern operating systems.

    Ranges/resume

    Both FTP and HTTP support resumed transfers in both directions, but HTTP supports more advanced byte ranges.

    Resumed transfers for FTP that start beyond the 2GB position has been known to cause trouble in the past but should be better these days.

    Persistent Connections

    For HTTP communication, a client can maintain a single connection to a server and just keep using that for any amount of transfers. FTP must create a new one for each new data transfer. Repeatedly doing new connections are bad for performance due to having to do new handshakes/connections all the time and redoing the TCP slow start period and more.

    HTTP Chunked Encoding

    To avoid having to close down the data connection in order to signal the end of a transfer - when the size of the transfer wasn't known when the transfer started, chunked encoding was introduced in HTTP.

    During a "chunked encoding" transfer, the sending party sends a stream of [size-of-data][data] blocks over the wire until there is no more data to send and then it sends a zero-size chunk to signal the end of it.

    Another obvious benefit (apart from having to re-open the connection again for next transfer) with chunked encoding compared to plain closing of the connection is the ability to detect premature connection shutdowns.

    Compression

    HTTP provides a way for the client and server to negotiate and choose among sevel compression algorithms. The gzip algorithm being the perhaps most compact one.

    FTP offers an official "built-in" run length encoding that compresses the amount of data to send, but not by a great deal on ordinary binary data. It has also traditionally been done for FTP using various "hackish" approaches that were never in any FTP spec.

    FXP

    FTP supports "third party transfers", often called "FXP". It allows a client to ask a server to send data to a third host, a host that isn't the same as the client. This is often disabled in modern FTP servers though due to the security implications.

    IPv6

    HTTP and FTP both support ipv6 fine, but the original FTP spec had no such support and still today many FTP servers don't have support for the necessary commands that would enable it. This also goes for the firewalls in between that need to understand FTP.

    Name based virtual hosting

    Using HTTP, you can easily host many sites on the same server and they are all differentiated by their names. In FTP, you cannot do name based virtual hosting at all. (It might become possible once the HOST command gets widely implemented...)

    Dir Listing

    One area in which FTP stands out somewhat is that it is a protocol that is directly on file level. It means that FTP has for example commands for listing dir contents of the remote server, while HTTP has no such concept.

    However, the FTP spec authors lived in a different age so the commands for listing directory contents (LIST and NLST) don't have a specified output format so it's a pain to write programs to parse the output. Latter specs (RFC3659) have addressed this with new commands like MLSD, but they are not widely implemented or supported by neither servers nor clients.

    Proxy Support

    One of the biggest selling points for HTTP over FTP is its support for proxies, already built-in into the protocol from day 1. The support is so successful and well used that lots of other protocols can be sent over HTTP these days just for its ability to go through proxies.

    FTP has always been used over proxies as well, but that was never standardized and was always done in lots of different ad-hoc approaches.

    Further

    There are further differences, like the HTTP ability to do conditional requests, negotiate content language and much more but those are not big enough to be specified in this document.

    Thanks

    Feedback and improvements by: Micah Cowan, Joe Touch, Austin Appel, Dennis German

    http://daniel.haxx.se/docs/ftp-vs-http.html

    'etc' 카테고리의 다른 글

    WDK 샘플 설치 삽질기  (0) 2013.07.28
    ADO 문제(오류번호: 80004003)  (0) 2012.07.10
    파일날짜 변경 시점  (0) 2010.07.09
    MSComm32.ocx 라이센스 등록  (0) 2010.06.18
    배치파일  (0) 2010.06.18
    블로그 이미지

    란마12

    ,

    파일날짜 변경 시점

    etc 2010. 7. 9. 09:59
    만든날짜, CreationTime
    액세스한 날짜, LastAccessTime, 사용한 날짜(win98)
    수정한 날짜, LastWriteTime, 바뀐 날짜(win98)


    복사: 만든 날짜, 액세스한 날짜
    수정: 수정한 날짜
    cut & paste: 날짜정보 변하지 않음

    'etc' 카테고리의 다른 글

    ADO 문제(오류번호: 80004003)  (0) 2012.07.10
    FTP vs HTTP  (0) 2011.04.14
    MSComm32.ocx 라이센스 등록  (0) 2010.06.18
    배치파일  (0) 2010.06.18
    컴퓨터명으로 IP알아내기  (0) 2010.04.19
    블로그 이미지

    란마12

    ,

    M$계열이 아닌 다른 개발툴에서 쓰고자 할 때...

    'etc' 카테고리의 다른 글

    FTP vs HTTP  (0) 2011.04.14
    파일날짜 변경 시점  (0) 2010.07.09
    배치파일  (0) 2010.06.18
    컴퓨터명으로 IP알아내기  (0) 2010.04.19
    원격데스크탑 클립보드 공유  (0) 2010.03.17
    블로그 이미지

    란마12

    ,

    배치파일

    etc 2010. 6. 18. 13:55

    도스에는 명령어를 일괄적으로 처리하기위한 배치파일이라는 것이 있습니다.
    대부분의 사람들은 배치파일이 도스환경을 쉽게 만든다는 사실을 과소평가하는데, 컴퓨터를 좀더 쉽게 사용하고 싶다면 배치파일을 꼭 짚고 넘어가는것이 좋습니다.

    배치파일이란 ?

    컴퓨터의 동작 상태를 살펴 보면 항상 사용자와의 상호작용에 의하여 작업이이루어진다는것을 알 수 있습니다.  도스라는 운영체제도 사용자가 명령을 입력하면 그 명령에 대해 도스가 분석하여 사용자가 원하는 실행 결과를 제공합니다.
    따라서 사용자는 항상 도스 프롬프트 상에서 일일이 키보드를 이용한 타이핑으로 명령을 내려야 하고, 하나의 명령이 내려지면 완료될 때까지 다음 명령을 내릴수가 없습니다. 작업 과정이 얼마되지 않는다면 큰 상관이 없으나 그 과정이 매우 길고 복잡하다면 사용자는 지루함을 느끼게 됩니다. 또한 비록 짧은 작업과정이라도 컴퓨터를 켤때마다 매번 똑같은 과정을 일일이 지시하는 것도 귀찮을 것입니다.
    이러한 경우 배치 파일은 가장 확실한 해결책입니다.

    배치파일의 기능은 순차적이고 반복된 동일한 작업 과정을 몇개의 혹은 수십, 수백 개의 연관된 명령어를 하나의 파일로 집약하여 그 하나의 파일(배치파일)만 실행함으로써 원하는 작업 과정을 수행하는것입니다.배치파일에 붙는 확장자는 .bat(batch 의 약어) 입니다.도스에서 실행이 가능하기 때문에 .com, .exe 확장자가 붙는 외부 명령어와 함께 실행 가능한 파일로 분류됩니다.차이가 있다면 .com, .exe 명령어는 컴퓨터만 해석 가능한 기계어 코드로 구성되어 있는반면, 배치 파일은 사람이 알아볼수 있는 일반 텍스트로 이루어져있다는 것입니다.

    그래서 사용자들은 문서작성에 이용하는 워드프로세서나 텍스트에디터 등을 이용해 배치 파일을 작성할 수 있습니다. 그러나 워드프로세서는 덩치가 크고 원래 목적이 편집과 출력을 위해 만들어진 것이므로 단순한 배치 파일을 작성하는 데는 권하고 싶지 않습니다.

    저장할때도 워드프로세서 고유의 포맷(예" .hwp 확장자를 가지는 아래아한글 데이터 파일)으로 저장하면 인식이 되지 않으므로 아스키 파일로 저장해야 합니다.가장 편리한 방법은 일반 문서 에디터( 도스의 Edit, Q에디터,U에디터 등)를 이용하거나 도스의 'Copy Con' 명령으로 배치 파일을 만드는 것입니다.다음과 같이 'Copy con 파일명' 형식으로 입력하고 엔터를 누르면 도스 프롬프트 상태에서 편집할 수 있는 상태가 됩니다.
    -------------------------------
    C:\Bats> copy con Timedate.bat
    cls
    time
    date
    ^Z

       1 File(s) copied
    -------------------------------

    여기서 쓰고 싶은 대로 적기만 하면 됩니다.제일 마지막행의 ^Z 는 파일의 제일 마지막 부분이라는 것을 도스에게 알려주는 코드로 <  Ctrl + Z > 키 또는 F6 키를 누르면 됩니다. 그리고 엔터키를 한번더 누르면 '1 File(s) copied' 라는 메세지가 출력되는데, 이는 방금 ' copy con 파일명 ' 으로 작성된 문서파일이 성공적으로 만들어졌다는 뜻입니다.위의 문서파일은 확장자가 .BAT 로 붙었기 때문에 실행가능한 외부 명령어가 되는데, 배치파일은 명령이 기록되어 있는 순서대로 실행되기 때문에 timedate.bat 를 실행시키면 먼저 화면을 지우고 난뒤 시스템의 시간과 날짜를 설정합니다.간단한 배치파일은 'copy con 파일명' 으로 작성하는 것이 다른 프로그램의 도움없이 쉽고 빠르게 처리할 수 있습니다. 하지만 배치파일이 조금 길거나 작성중에 수시로 편집할 일이 생기는 경우에는 불가능합니다. 'copy con 파일명' 으로 파일을 작성하면 행으로 다시돌아갈 수 없을 뿐 아니라 수정이 불가능하기 때문입니다. 그러므로 배치파일을 만들 필요가 있을때는 문서 에디터를 이용하는 것이 좋습니다.

    ▶  
    배치파일 작성 명령어 9인방

    배치 파일은 파일 안에 기록되어 있는 명령의 순서대로 실행됩니다.가장 대표적인 것이 부팅에 이용되며, 컴퓨터의 루트 디렉토리에 위치하고 있는 Autoexec.bat 파일입니다. 그런데 만약 배치 파일의 실행의 순서를 순차적이 아닌멀티부팅용 Autoexec.bat 처럼 사용자 마음대로 정하고 싶다면 배치파일에 제공되는배치명령어의 용도를 알고 있어야 합니다.


    1. CALL


    현재 실행중인 배치 파일을 종료하지 않고 필요한 다른 배치파일을 호출하여 실행한 다음 원래의 배치파일로  다시 돌아오려고 할 때 사용됩니다.

    ◇ 사용법 : Call [drive:]\[경로]\<배치파일명>[.BAT]

    ◇ 예  :  Call c:\bats\sample.bat

    어떤 배치 파일을 실행하는 도중에 경로 C:\bats 에 있는  sample.bat 파일을 실행한 다음 다시 원래의 배치파일로 돌아옵니다.


    2. CHOICE

    배치 프로그램 내에서 사용자의 선택을 묻기 위해 사용됩니다. 배치 파일 제작자가 설정한 물음을 출력하면서 지정된 키 입력을 기다립니다. 이 명령은 배치파일 내에서만 사용 가능합니다.

    ◇ 사용법 :choice [/C[:]문자열][/N][/S][/T[:]기본키,대기시간][메세지]

    ◇ 옵션

    - /C[:]문자열  : 사용자가 선택할 수 있는 키목록을 [] 괄호 내에 ', ' 로 구분하여 출력하고  /C 스위치를 사용하지 않으면 기본적으로  YN이 사용됩니다.

    - /N : 프롬프트를 출력하지 않도록 합니다.

    - /S : 사용자의 입력에서 소문자, 대문자를 구분하도록 합니다.

    - /T[:]기본키, 대기시간 : 기본키를 지정한 후 대기시간 동안 사용자의 키 입력이 없으면  자동적으로 기본키가 입력된 것으로 간주하고 진행됩니다. 지정 가능한 대기시간은 초단위이며 0에서 99 사이의 값입니다.

    - 메세지 : 화면에 출력될 메세지를 지정합니다.

    ◇ 예 : choice /c:abCD /s /t : C, 5 다음중에서 하나를 선택하십시오 a, b, C, D
    ◇ 설명 : 입력 가능한 키를 a,b,C,D로 한정하며 사용자로부터 입력되는 영문자의 대,소문자를 구분하는데, 만약 5초 내에 사용자로부터 키 입력이 없다면 C 가 입력된 것으로 간주합니다. 그리고 화면에는
    '다음중에서 하나를 선택하십시오 a, b, C, D[a,b,C,D]? ' 
    라는 메세지가 출력됩니다.


    3. ECHO

    배치파일 실행중에 명령어를 화면에 표시할 것인지의 여부를 설정하며, 그 상태를 표시합니다. 한편 ECHO 명령 뒤에 오는 메세지는 화면에 나타납니다.

    ◇ 사용법 : echo [on/off] [문자열]

    ◇ 옵션
    - on : 배치 파일 실행중에 그 배치 파일 내의 명령어를 화면에 표시합니다. 
    - off : 배치 파일 실행중에 명령어를 화면에 출력하지 않도록 합니다.
    - 문자열 : 화면에 출력하고 싶은 메세지를 적어줍니다.
    - 없음 : 현재 ECHO 설정 상태를 표시합니다.

    ◇ 예  :

    echo off   
    ☞ 현재 실행중인 배치 파일 내의 명령어를 화면에  나타나지 않도록 함.
    echo
    echo 안녕하세요?~
    ☞ 현재 echo 설정상태를 표시하며  안녕하세요?~ 라는 문구를 화면에 출력합니다.  


    4. FOR

    지정된 집합 중의 각각의 요소에 대하여 명령으로 설정한 처리를 반복 실행합니다.

    ◇ 사용법

    For %%<변수> IN (<집합>) DO <명령> [<옵션>]    ☞ 배치파일용. 
    For %<변수> IN (<집합>) DO <명령> <옵션>]        ☞ 순차처리용.


    ◇ 옵션

    - %%<변수>, &<변수>  : 변수로 사용되는 것은 임의의 영문자로 1자만 허용됩니다.  주의할 점은 배치파일에서 사용할 경우는 반드시 %%처럼 두개를 연달아 사용해야 하며, 일반 도스 프롬프트에서 사용할 때는 % 하나만 사용합니다.

    - <집합> : %%<변수>에 대입하고 싶은 값을, 또는 스페이스로 구분하여 대입하고 싶은 순서대로 나열합니다.

    - <명령> : %%<변수>에 대입되어 있는 값에대해 반복적으로 실행하고 싶은 명령을 지정합니다.

    - <옵션> : 지정한 명령의 옵션이나 FOR 명령에서 지정한 옵션을 설정합니다.

    ◇ 예

    for  %%f  in  (bak tmp $$$) do del *.%%f /p       ☞ 배치파일의 경우
    for %d  in  (read,wh,file) do hlist %d*.*              ☞ 도스 프롬프트에서 실행시

    ◇ 설명 : 첫 번째는 bak, tmp, $$$ 를 순서대로 %%f 환경 변수에 대입하여 차례대로
     DEL *.bak /p, DEL *.tmp /p, DEL *.$$$ .p 를 실행한 것과 동일한 결과를 얻게됨.

    두번째는 READ,WH,FILE 를 순서대로 %d 환경변수에 대입하여 차례대로
     HLIST READ*.*, HLIS TWH *.* , HLIST FILE *.* 를 실행한 것과 동일한 결과를 얻게 됩니다.


    5. GOTO

    배치 처리의 흐름을 <레이블>에서 정의되어 있는 위치로 옮깁니다.

    ◇ 사용법 : Goto <레이블>

    ◇ 예 :
    goto loop
    :loop
    각종 처리할 내용


    ◇ 설명  : 레이블 loop 로 배치 처리의 제어권을 이동시켜 loop 항목에 지정된 각종 처리할 내용을 실행시킵니다.

    ◇ 참고  : 배치 파일에 레이블 표시는 레이블명 앞에 콜론(:) 을 붙여주며 줄을
                  바꿔 맨 앞에 지정해 주어야 합니다.



    6. IF

    지정한 조건의 판단 결과에 따라서 배치 처리를 진행합니다.

    ◇ 사용법 :  If [NOT] <조건> <명령>

    ◇ 옵션

    - NOT : 지정한 조건의 반대 조건일 때만 실행합니다.

    - 조건

    - ERRORLEVEL <수치> : 바로 전에 실행한 명령(프로그램)의 종료 코드가 <수치> 이상일 때에는 참이 되고 <명령> 이 실행됨.

    - <문자열1> == <문자열2> : <문자열1> 과 <문자열2> 가 같을 때에만 참이되고 <명령>이 실행됩니다. 주의할 점은 문자열의 대,소문자가 구별되며, 문자열중에 구분기호(콤마,스페이스,세미콜론,등호,탭)가 포함되어 있으면 않됩니다.

    - EXIST <파일명> : <파일명>으로 지정한 파일(경로포함)이 존재할 때에만 참이 되고    <명령>이 실행됩니다. <파일명>에는 와일드카드 문자의 사용이 가능합니다.

    ◇ 예 :
    if errorlevel 2 goto quit
    if not %1 ==%2 goto process
    if exist d:\work\temp.$$$ del d:\work\temp.$$$


    ◇ 설명 :
    직전에 실행한 명령의 종료 코드가 2 이상일 경우 레이블  QUIT로 이동합니다.

    환경변수 %1과 환경변수 %2에 대입되어 있는 문자열이 같지 않을 경우에만 레이블 PROCESS 로 이동합니다.

    경로 D:\Work 에 temp.$$$ 라는 파일이 존재하면 그 파일을 삭제합니다.


    7. PAUSE

    배치 파일 실행을 일시 정지합니다.

    ◇ 사용법 : Pause [문자열]

    ◇ 옵션

    - 문자열 : 문자열을 생략하면 'press any key to continue...'라는 메세지가 화면에  출력됩니다. 만약 PAUSE 명령 뒤에 어떤 메세지를 지정하여 그 메시지를  출력하고 싶다면 'Echo On' 명령을 우선 내려야 합니다.

    ◇ 예 :   
     echo on
     pause  준비가 되었으면 아무키나 누르세요...


    ◇ 설명 :  배치 처리 중 pause명령을 만났을때 임의의 다른 메시지를 화면에 출력하고 싶다면 예 에서와 같이 반드시 echo on 명령이 선행되어야 하며 예의 경우에는  ' 준비가 되었으면 아무키나 누르세요...' 라는 메세지가 출력됩니다.

    ◇ 참고 :  위 처럼 하면 화면에 Pause 라는 명령어까지 같이 출력되므로 이런경우
    echo on 
    echo  준비가 되었으면 아무키나 누르세요...
    pause > Null


    이런식으로 사용하면 출력하고자 하는 메세지만 화면에 출력됩니다.


    8. REM

    배치 파일 내에 주석문을 부여하고 싶을 때 사용합니다.

    ◇ 사용법 : rem [문자열]

    ◇ 옵션    

    - 문자열 : 주석문으로 쓰고 싶은 것을 적어줍니다.

    ◇ 예 : REM 이 배치파일은 샘플입니다.

    배치파일내의 적당한 위치에 적절한 주석문을 붙여두면 배치 처리의 흐름을 일목요연하게 볼 수 있습니다.


    9. SHIFT

    배치 파일에 주어진 파라미터(%1~%9)와 실행시에 지정되는 값과의 대응을 하나씩 뒤로 이동하여 표시합니다.

    ◇ 예

    :loop
    if "%1" == " " goto end
    echo %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
    shift
    goto loop
    :end    


    위와 같이 배치 파일을 작성해두고 다음과 같이 배치파일을  실행해 보면 shift 명령이 어떤 역할을 하는지 금방 알 수 있습니다..
    C:\bats> test.bat A B C D E F G H I J 0 1 2 3 4 5  똑같이 입력하고 실행후 확인.

    'etc' 카테고리의 다른 글

    FTP vs HTTP  (0) 2011.04.14
    파일날짜 변경 시점  (0) 2010.07.09
    MSComm32.ocx 라이센스 등록  (0) 2010.06.18
    컴퓨터명으로 IP알아내기  (0) 2010.04.19
    원격데스크탑 클립보드 공유  (0) 2010.03.17
    블로그 이미지

    란마12

    ,

    - NetBIOS연결을 위해 컴퓨터명으로 목적지 컴퓨터에 접속(예: 실행창에서 \\목적지컴퓨터명)
    - NetBIOS연결목록을 조회하기 위해 커맨드창에서 nbtstat -S

    'etc' 카테고리의 다른 글

    FTP vs HTTP  (0) 2011.04.14
    파일날짜 변경 시점  (0) 2010.07.09
    MSComm32.ocx 라이센스 등록  (0) 2010.06.18
    배치파일  (0) 2010.06.18
    원격데스크탑 클립보드 공유  (0) 2010.03.17
    블로그 이미지

    란마12

    ,