2016年11月22日 星期二

[DOS][cmd]net use

Net use \\server\path\ password /user:"username"

 

Bat file

cmd.exe /C net use

cmd.exe /C net use \\10.85.68.13\TestLog /delete

cmd.exe /C net use \\10.85.68.13\Temp /delete

pause

 

 

 

C:\>cmd /?

啟動 Windows XP 命令直譯器新例項

 

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]

    [[/S] [/C | /K] string]

 

/C      執行字串中所描述的命令然後結束命令視窗

/K      執行 字串中所描述的命令然後保留命令視窗

/S      修改字串在 /C /K (參看下方)

/Q      關閉 echo

/D      從登錄中停用 AutoRun 命令(參看下方)

/A      將內部命令輸出結果以 ANSI 格式導向 pipe 或檔案

/U      將內部命令輸出結果以 Unicode 格式導向 pipe 或檔案

/T:fg   設定幕前/幕後色彩 (參看 COLOR /?)

/E:ON   啟用命令延伸 (參看下方)

/E:OFF  停用命令延伸 (參看下方)

/F:ON   啟用檔案及目錄名稱完整字元(參看下方)

/F:OFF  停用檔案及目錄名稱完整字元(參看下方)

/V:ON   啟用延遲環境變數延伸,用 c 作為分隔字元。例如,

        /V:ON 可以讓 !var! 在執行時展開變數 var。文法

        var 則會在輸入時展開變數,這在 FOR 迴圈之中是

        完全不同的事。

/V:OFF  停用延遲環境變數展開

 

例如:

cmd /u /c dir /b mp3 > mp3_list.txt

 

上面這一行指令做了以下的事情:

cmd /u /c :告訴 cmd

dir mp3 目錄中的檔名輸出到 mp3_list.txt 中儲存 (紅色的指令)

**********************Confidentiality Notice************************
The opinions and views expressed in this e-mail are solely those of the author and do not necessarily represent our company and its affiliates. If this e-mail is not originally intended for you, or received by you in error, do not disclose its content to anyone and delete it immediately. This e-mail may contain information that is legally privileged, confidential or exempt from disclosure.

沒有留言:

張貼留言