修改 win8 host (C:\Windows\System32\Drivers\etc)
[1] 修改編輯權限
選擇 hosts 右鍵->內容->安全性->點擊"群組或使用者名稱"下面的編輯->修改 ALL APPLICATION PACKAGES 權限->將"修改"勾選允許
[2] notepad++ 以系統管理員執行身份
C:\Program Files (x86)\Notepad++\notepad++.exe
右鍵->以系統管理員身份執行
[3] 就可以在 hosts 加入要對應的 ip 跟 domain
發生 'ping' 不是內部或外部命令、可執行的程式或批次檔。
發生原因 : C:\Windows\system32
放一些如 ping.exe, 所以當 PATH 路徑未指到 C:\Windows\system32
解決方法1 :
cd C:\Windows\system32
ping www.google.com.tw
解決方法2 :
將 PATH 全域變數指向 %SystemRoot%\system32;%SystemRoot%
- 如果 PATH 本身已有設定值, 以
;
分隔
%systemRoot%
是 C:\Windows
.bat 語法
pause
: 暫停, 當指令執行完不要直接關閉視窗
清除 dns cache
ipconfig /flushdns
清除瀏覽器指令 :
- chrome :
chrome://net-internals/#dns
- firefox :
about:config
-> network.dnsCacheExpiration
= 0
顯示環境變數
echo %PATH%
查看本機網卡 mac
ipconfig/all
檢查連線
ping 192.168.1.2 -n 1 -w 200
-n
: count, 要傳送的 echo 要求數目
-w
: timeout, 每個回覆的等候逾時(毫秒)
迴圈執行 ping
for /L %i in (1,1,254) do ping 192.168.128.%i -n 1 -w 200 > NUL
ARP
清除記憶體的網卡紀錄
arp -d *
判斷幾位元
systeminfo
- x64-based PC => 64bits
- x86-based PC => 32bits
Dos 指令
Unix / Dos 對照表
Unix Dos
------------------
cd cd
mkdir md mkdir 也是可以的
rmdir rd rmdir 也是可以的
pwd cd
env set
setenv set
rm del
cat/more type
ls dir
lp print
cp copy
date date/time
mv ren
man help
clear cls
dir /p 只出現一頁, 按 enter 到下一頁
dir /w 只顯示檔案名稱
dir /s xxx.txt 搜尋檔案
FORMAT C: 格式化 C:\
COPY A: lmi.txt C: hsuyin.txt COPY 檔案
COPY A: *.EXE C: COPY 檔案
dir > 1.txt 將 dir 的內容傳到 1.txt