1 / 17

コマンドプロンプト操作 (1)

コマンドプロンプト操作 (1). コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 C コンパイルとプログラムの実行. 今日のポイント. コマンドプロンプトに慣れよう. コマンドプロンプトの起動と終了. 起動 ( マウス ) [ スタート ] を < クリック > [ すべてのプログラム( P )] [ Microsoft Visual Studio 2005 ] [ Visual C++ コマンドプロンプト ] を < クリック >.

Télécharger la présentation

コマンドプロンプト操作 (1)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. コマンドプロンプト操作(1) コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 Cコンパイルとプログラムの実行 今日のポイント コマンドプロンプトに慣れよう

  2. コマンドプロンプトの起動と終了 起動(マウス) • [スタート] を<クリック> • [すべてのプログラム(P)] • [Microsoft Visual Studio 2005] • [Visual C++コマンドプロンプト] を<クリック> コマンドプロンプトはCUI(Character-based User Interface)でコマンドを実行 終了(キーボード) • 「exit」 と入力して <Enter> 終了(マウス) • 右上の [x]ボタンを<クリック> x 練習:実際にコマンドプロンプトを起動して終了せよ。

  3. コマンドプロンプトのショートカットをデスクトップに作成コマンドプロンプトのショートカットをデスクトップに作成 • [スタート]を<クリック> • [すべてのプログラム(P)] • [Microsoft Visual Studio 2005] • [Visual C++コマンドプロンプト] を • [送る(N)] • [デスクトップ (ショートカットを作成)] を<クリック> <右クリック>

  4. 最初に覚えるコマンド • dir(directory) ディレクトリ中のファイル一覧表示 • cdまたはchdir(change directory) ディレクトリの変更 (親ディレクトリは「..」,現在地は 「.」) • <ドライブ文字>: ドライブ(A:~Z:)の変更 • help 各コマンドのヘルプ情報の表示

  5. HELPの練習 • helpを実行せよ Z:\>help<Enter> • help dirまたは dir /?を実行し、/s,/xなどのオプション指定時の動作が書いてある箇所を確認せよ • help cdまたは cd /?を実行せよ コマンドプロンプトでは、大文字と小文字は区別されないことに注意 Z:\>helpdir<Enter> Z:\>dir/?<Enter> Z:\>helpcd<Enter> Z:\>cd/?<Enter>

  6. ディレクトリ構成とパス dir /xで表示 • ディレクトリ=フォルダ • 8文字より長い名前には短い別名がつけられる。 • 空白を含む場合は引用符(")でくくる必要あり。 • パス = <ドライブ>\<ディレクトリ>\… 例 • Z:\VISUAL~1= "Z:\Visual Studio 2005" デスクトップ [-]マイ コンピュータ [-] 'fs\home\students'のt082900 (Z:) [+] Visual Studio 2005 エクスプローラでの ツリー構造記述

  7. GUIでのパス名表示の設定 • 「 マイ ドキュメント」 を開く • メニューバーの [ツール (T)] を<クリック> • [ フォルダ オプション(O)...] を<クリック> • [表示]タブを選択 • 「アドレス バーにファイルのパス名を表示する」 が  <チェック>されていることを確認 • 「タイトル バーにファイルのパス名を表示する」 が <チェック>されていることを確認 • [OK ] ボタンを<クリック>

  8. 有用なコマンドとワイルドカード • tree (ディレクトリ構造の表示) • md / mkdir (make directory:ディレクトリの作成) • copy (ファイルのコピー) • del(delete:ファイルの削除) • ren(rename: ファイル名の変更) • more (ページごとの表示) • * (任意の文字列) • ?(任意の一文字) 「del*.*」はディレクトリ内全ファイル一括削除 「del???.?」は<3文字>.<1文字>の形の名前の全ファイル削除

  9. ディレクトリ移動、一覧表示の練習(1) • ソースファイルのある場所に移動 または • 一覧表示 Z:\nyumon1\hello>dir Z:\nyumon1\hello>dir /ogn Z:\nyumon1\hello>dir /w Z:\nyumon1\hello>dir /d Z:\nyumon1\hello>dir /ogn /s Z:\>cdnyumon1 Z:\nyumon1>cdhello Z:\ nyumon1\ hello\ Debug\ hello.obj hello.exe ... hello.c ... ... Z:\>cdnyumon1\hello グループ・名前順 ワイド版 ワイド版(列方向) サブディレクトリ、グループ・名前順 ディレクトリ名が日本語や空白を含む場合は、それらを含まない名前に直しておく。

  10. プログラムの実行 • 実行ファイルのある場所に移動 Z:\nyumon1\hello>cdDebug • 実行 あるいは 開発環境で作成した実行ファイルはDebugフォルダ内 Z:\nyumon1\hello\Debug>hello Z:\nyumon1\hello\Debug>hello.exe Z:\ nyumon1\ hello\ Debug\ hello.exe ... 練習:今まで作成した他のプログラムもコマンドプロンプト上で実行してみよ

  11. ディレクトリ移動、一覧表示の練習(2) 親 • 親ディレクトリに移動 Z:\nyumon1\hello\Debug>cd.. Z:\nyumon1\hello>cd.. • ツリー構造表示 Z:\nyumon1>tree. Z:\nyumon1>treehello • ツリー構造表示(ページごと) Z:\nyumon1>tree.|more • 一覧表示(サブディレクトリ・ページごと) Z:\nyumon1>dir/ogn/s/p Z:\nyumon1>dir/ogn/s/d/p Z:\ nyumon1\ hello\ Debug\ hello.exe hello.obj ... hello.c 現在地 縦棒は<Shift>+<\> 「パイプ」は次回にくわしく説明

  12. ディレクトリ作成、ファイルコピーの練習 • nyumon2, nyumon2\helloの作成(すでにある人は省略) Z:\nyumon1>cd.. Z:\>mdnyumon2 Z:\>mdnyumon2\hello • hello.cのコピー • 確認 Z:\>cdnyumon2 Z:\nyumon2>dir/s 親 Z:\ nyumon1\ hello\ hello.c ... nyumon2\ hello\ hello.c Z:\>copynyumon1\hello\hello.cnyumon2\hello 同じファイル名でよいときは省略可 サブディレクトリ

  13. ファイルコピー、削除、名前変更 • ファイルの別名コピー Z:\nyumon2>cdhello Z:\nyumon2\hello>copyhello.ctmp.c Z:\nyumon2\hello>dir • hello.cの削除 Z:\nyumon2\hello>delhello.c Z:\nyumon2\hello>dir • tmp.cの名前変更 Z:\nyuomn2\hello>rentmp.chello.c Z:\nyumon2\hello>dir Z:\ nyumon2\ hello\ hello.c tmp.c Z:\ nyumon2\ hello\ tmp.c Z:\ nyumon2\ hello\ hello.c

  14. Cコンパイルとプログラムの実行 • CLコマンド(compile and link) Z:\nyumon2\hello>clhello.c • 実行ファイル確認 Z:\nyumon2\hello>dir • 実行 Z:\nyumon2\hello>hello Z:\ nyumon2\ hello\ hello.c hello.obj hello.exe ... ... さらに詳しく知りたい人は以下を参照のこと http://www.ced.is.utsunomiya-u.ac.jp/lecture/2006/common/vs2005/ command_prompt.php

  15. 中級者向け 「作業フォルダ」の設定 • デスクトップの「Visual C++コマンドプロンプト」の ショートカットを • [プロパティ(R)] を<クリック> 「Visual C++コマンドプロンプトのプロパティ」 ウィンドウ • [ショートカット] タブを選択 • [作業フォルダ(S):] 欄に起動時のデフォルトパス名(例えば 「Z:\nyumon2」)を記入 • [OK ] ボタンを<クリック> <右クリック> 一番下

  16. 中級者向け 「簡易編集モード」の設定 • 上部のタイトルバー [ Visual C++ コマンドプロンプト]を • [プロパティ(P)] を<クリック> 「 “Visual C++ コマンドプロンプト”のプロパティ」 ウィンドウ • 「オプション」 タブを選択 • 「編集オプション」 欄の   □簡易編集モード(Q)を<チェック> <右クリック> 一番下

  17. 中級者向け コマンドプロンプトの参考サイト • コマンドプロンプトに興味がわいた人は下記サイトも参照 http://cmd-pro.com/ http://www.confrage.com/dos/ http://ykr414.com/dos/ http://pcweb.mycom.co.jp/special/2002/xpcommand/ 今日のポイント コマンドプロンプトに慣れよう

More Related