国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
Windows Scripting - 簡(jiǎn)易資料備份

September 17, 2007

Windows Scripting - 簡(jiǎn)易資料備份


今天收到命令,要做定時(shí)的備份工作,備份的目的地要在遠(yuǎn)端的網(wǎng)路磁碟機(jī)上

掛載、卸載網(wǎng)路磁碟機(jī)

因此就去查詢(xún)?nèi)绾卧?Windows 上寫(xiě) script 掛載網(wǎng)路磁碟機(jī),以下找到一段語(yǔ)法:

WshNetwork.MapNetworkDrive
maps a remote drive onto a local drive letter

Syntax:
WshNetwork.MapNetworkDrive (strLocalName, strRemoteName [,bUpdateProfile] [,strUser] [,strPassword])
strLocalName
Receives the drive letter to which to map the remtoe share point in strRemoteName.
strRemoteName
Receives the name ofd the remote share point that will be mapped to the drive letter in strLocalName.
bUpdateProfile
If this optional parameter is True, the mapping will be saved in the current user's profile.
strUser
When combined with strPassword, this parameter can be used to conenct to a remote drive using someone else's credentials.
strPassword
When combined with strUser, this parameter can be used to conenct to a remote drive using someone else's credentials.
接著是卸載網(wǎng)路磁碟機(jī)的語(yǔ)法:
WshNetwork.RemoveNetworkDrive
removes a previously mapped network drive

Syntax:
WshNetwork.RemoveNetworkDrive (strName, [,bForce] [,bUpdateProfile])
strName
Receives the name of a previously mapped share point to be removed.
bForce
If this optional parameter is set to True, then this method will remove the connection even if the resource is currently being used.
bUpdateProfile
If this optional parameter is set to True, the mapping will be removed from the current user's profile.

以下是他的 sample code:
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
strLocalDrive = "H:"
strRemoteShare = "\\myserver\users"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, False '沒(méi)有第四、五個(gè)參數(shù),表示不需帳號(hào)密碼
objNetwork.RemoveNetworkDrive strLocalDrive '卸載網(wǎng)路磁碟機(jī)

資料複製

另外還要將本地資料複製到網(wǎng)路磁碟機(jī)上,可用以下一段簡(jiǎn)單的語(yǔ)法達(dá)成:(也是範(fàn)例語(yǔ)法)
set fs = CreateObject("Scripting.FileSystemObject")

'將 c:\win98 中所有的內(nèi)容複製到 z:\backup (不包含 c:\win98 資料夾)
fs.copyFolder "c:\win98","z:\win99"

'將 c:\win98 中所有的內(nèi)容複製到 z:\backup (包含 c:\win98 資料夾)
fs.copyFolder "c:\win98","z:\win99\"

參考資料

  1. WSH >> Objects >> wshnetwork
  2. WSH >> wshnetwork >> MapNetworkDrive
  3. WSH >> wshnetwork >> RemoveNetworkDrive
  4. WshNetwork.MapNetworkDrive
  5. 資安論壇 - 求助!有時(shí)需要reboot或re-log才看見(jiàn)net use的network drive
  6. Windows Script 介紹 - 檔案及資料夾的處理

 

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
方便用戶(hù)共享資源,在域內(nèi)通過(guò)腳本給域內(nèi)計(jì)算機(jī)映射網(wǎng)絡(luò)驅(qū)動(dòng)器-微軟技術(shù)-Cnfan.net中國(guó)網(wǎng)絡(luò)
XP自身【可完整清除垃圾】的秘密武器
利用腳本添加網(wǎng)絡(luò)打印機(jī)方法詳解
【玩轉(zhuǎn)電腦】隱藏在XP中的一個(gè)秘密武器!
三個(gè)位置放電腦,切忌!
磁碟音樂(lè),樂(lè)在其中,令人陶醉
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服