コマンドプロンプト操作 (1)
DESCRIPTION
コマンドプロンプト操作 (1). コマンドプロンプトの起動と終了 最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 C コンパイルとプログラムの実行. 今日のポイント. コマンドプロンプトに慣れよう. コマンドプロンプトの起動と終了. 起動 ( マウス ) [ スタート ] を < クリック > [ すべてのプログラム( P )] [ Microsoft Visual Studio 2005 ] [ Visual C++ コマンドプロンプト ] を < クリック >. - PowerPoint PPT PresentationTRANSCRIPT
コマンドプロンプト操作(1)
コマンドプロンプトの起動と終了
最初に覚えるコマンド ディレクトリ構造とパス 各種コマンドの練習 C コンパイルとプログラムの実
行コマンドプロンプトに慣れよう
今日のポイント
起動(マウス) [ スタート ] を < クリック > [ すべてのプログラム( P)] [Microsoft Visual Studio 2005] [Visual C++ コマンドプロンプト ] を < クリック >
コマンドプロンプトの起動と終了
終了 ( キーボード ) 「 exit 」 と入力して <Enter>
終了 ( マウス ) 右上の [x] ボタンを < クリック >
練習:実際にコマンドプロンプトを起動して終了せよ。
コマンドプロンプトはCUI ( Character-based User Interface )でコマンドを実行
x
コマンドプロンプトのショートカットをデスクトップに作成
[ スタート ] を < クリック > [ すべてのプログラム (P)] [Microsoft Visual Studio 2005]
[Visual C++ コマンドプロンプト ] を [ 送る (N)] [ デスクトップ (ショートカットを作成) ] を
<クリック>
< 右クリック >
最初に覚えるコマンド dir (directory)
ディレクトリ中のファイル一覧表示 cd または chdir (change directory)
ディレクトリの変更
( 親ディレクトリは 「 .. 」,現在地は 「 . 」 )
< ドライブ文字 >:ドライブ (A:~Z:) の変更
help各コマンドのヘルプ情報の表示
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>
ディレクトリ構成とパス
ディレクトリ=フォルダ 8 文字より長い名前には短い別名がつけられる。 空白を含む場合は引用符 (") でくくる必要あり。 パス = < ドライブ >\< ディレクトリ >\…
例 Z:\VISUAL~1 = "Z:\Visual Studio 2005"
エクスプローラでのツリー構造記述
デスクトップ[-] マイ コンピュータ [-] 'fs\home\students' の t082900 (Z:) [+] Visual Studio 2005
dir /x で表示
GUI でのパス名表示の設定
「 」 を開くマイ ドキュメント メニューバーの [ ツール (T)] を < クリック
> [ フォルダ オプション (O)...] を < クリック > [ 表示 ] タブを選択 「 アドレス バーにファイルのパス名を表示する」 が
< チェック > されていることを確認 「 に の 名を表示するタイトル バー ファイル パス 」 が
< チェック > されていることを確認 [ OK ] ボタンを < クリック >
有用なコマンドとワイルドカード tree ( ディレクトリ構造の表示 ) md / mkdir (make directory: ディレクトリの作
成 ) copy ( ファイルのコピー ) del (delete: ファイルの削除 ) ren (rename: ファイル名の変更 ) more ( ページごとの表示 ) * ( 任意の文字列 )「 del *.* 」はディレクトリ内全ファイル一括削除
「 del ???.? 」は <3 文字 >.<1 文字 > の形の名前の全ファイル削除
? ( 任意の一文字 )
ディレクトリ移動、一覧表示の練習 (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:\ nyumon1\ hello\ Debug\ hello.obj hello.exe ... hello.c ... ...
ディレクトリ名が日本語や空白を含む場合は、それらを含まない名前に直しておく。
Z:\>cd nyumon1Z:\nyumon1>cd hello
Z:\>cd nyumon1\hello
グループ・名前順
ワイド版
ワイド版 (列方向 )サブディレクトリ、グループ・名前順
プログラムの実行 実行ファイルのある場所に移動
Z:\nyumon1\hello>cd Debug 実行
あるいは
Z:\ nyumon1\ hello\ Debug\ hello.exe ...
Z:\nyumon1\hello\Debug>hello
Z:\nyumon1\hello\Debug>hello.exe
練習:今まで作成した他のプログラムもコマンドプロンプト上で実行してみよ
開発環境で作成した実行ファイルはDebug フォルダ内
ディレクトリ移動、一覧表示の練習 (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>+<\>
「パイプ」は次回にくわしく説明
ディレクトリ作成、ファイルコピーの練習 nyumon2, nyumon2\hello の作成 ( すでにある人は省略 )
Z:\nyumon1>cd ..
Z:\>md nyumon2
Z:\>md nyumon2\hello
hello.c のコピー
確認Z:\>cd nyumon2
Z:\nyumon2>dir /s
Z:\>copy nyumon1\hello\hello.c nyumon2\hello
Z:\ nyumon1\ hello\ hello.c ... nyumon2\ hello\ hello.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
Z:\nyumon2\hello>dir
tmp.c の名前変更
Z:\nyuomn2\hello>ren tmp.c hello.c
Z:\nyumon2\hello>dir
Z:\ nyumon2\ hello\ hello.c tmp.c
Z:\ nyumon2\ hello\ hello.c
Z:\ nyumon2\ hello\ tmp.c
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 ... ...
さらに詳しく知りたい人は以下を参照のことhttp://www.ced.is.utsunomiya-u.ac.jp/lecture/2006/common/vs2005/
command_prompt.php
「作業フォルダ」の設定 デスクトップの「 Visual C++ コマンドプロ
ンプト」の ショートカットを [ プロパティ (R)] を < クリック >
「 Visual C++ コマンドプロンプトのプロパティ」 ウィンドウ [ ショートカット ] タブを選択 [ 作業フォルダ (S):] 欄に起動時のデフォルトパス
名(例えば 「 Z:\nyumon2 」)を記入 [ OK ] ボタンを < クリック >
中級者向け
< 右クリック >
一番下
「簡易編集モード」の設定
上部のタイトルバー[ Visual C++ コマンドプロンプト ] を
[ プロパティ (P)] を < クリック >
「 “ Visual C++ コマンドプロンプト”のプロパティ」 ウィンドウ
「オプション」 タブを選択 「編集オプション」 欄の □簡易編集モード (Q) を < チェック >
中級者向け
< 右クリック >
一番下
コマンドプロンプトに慣れよう今日のポイント
http://cmd-pro.com/
http://www.confrage.com/dos/
http://ykr414.com/dos/
http://pcweb.mycom.co.jp/special/2002/xpcommand/
中級者向けコマンドプロンプトの参考サ
イト コマンドプロンプトに興味がわいた
人は下記サイトも参照