Presentation is loading. Please wait.

Presentation is loading. Please wait.

コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 Cコンパイルとプログラムの実行

Similar presentations


Presentation on theme: "コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 Cコンパイルとプログラムの実行"— Presentation transcript:

1 コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 Cコンパイルとプログラムの実行
コマンドプロンプト操作(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)
ディレクトリ中のファイル一覧表示 cd または chdir (change directory) ディレクトリの変更 (親ディレクトリは 「..」,現在地は 「.」 ) <ドライブ文字>: ドライブ(A:~Z:)の変更 help 各コマンドのヘルプ情報の表示

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

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

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

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

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

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

11 縦棒は <Shift>+<\>
ディレクトリ移動、一覧表示の練習(2) 親ディレクトリに移動 Z:\nyumon1\hello\Debug>cd .. Z:\nyumon1\hello>cd .. ツリー構造表示 Z:\nyumon1>tree . Z:\nyumon1>tree hello ツリー構造表示(ページごと) 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 ディレクトリ作成、ファイルコピーの練習 prog, prog\hello の作成 (すでにある人は省略) hello.c のコピー 確認
Z:\nyumon1>cd .. Z:\>md nyumon2 Z:\>md nyumon2\hello hello.c のコピー 確認 Z:\>cd nyumon2 Z:\nyumon2>dir /s Z:\ nyumon1\ hello\ hello.c ... nyumon2\ Z:\>copy nyumon1\hello\hello.c nyumon2\hello 同じファイル名でよいときは省略可 サブディレクトリ

13 ファイルコピー、削除、名前変更 ファイルの別名コピー hello.c の削除 tmp.c の名前変更
Z:\nyumon2>cd hello Z:\nyumon2\hello>copy hello.c tmp.c Z:\nyumon2\hello>dir hello.c の削除 Z:\nyumon2\hello>del hello.c tmp.c の名前変更 Z:\nyuomn2\hello>ren tmp.c hello.c 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>cl hello.c 実行ファイル確認 Z:\nyumon2\hello>dir 実行 Z:\nyumon2\hello>hello Z:\ nyumon2\ hello\ hello.c hello.obj hello.exe ... さらに詳しく知りたい人は以下を参照のこと command_prompt.php

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

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

17 コマンドプロンプトの参考サイト コマンドプロンプトに興味がわいた人は下記サイトも参照 今日のポイント コマンドプロンプトに慣れよう
中級者向け コマンドプロンプトに興味がわいた人は下記サイトも参照 今日のポイント コマンドプロンプトに慣れよう


Download ppt "コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 Cコンパイルとプログラムの実行"

Similar presentations


Ads by Google