Cov txheej txheem:

VBScript Drive Xauv: 5 Kauj Ruam
VBScript Drive Xauv: 5 Kauj Ruam

Video: VBScript Drive Xauv: 5 Kauj Ruam

Video: VBScript Drive Xauv: 5 Kauj Ruam
Video: 08-02-2020 || English Service "Assurance of Salvation" || Dr. Txawj Riam Xyooj 2024, Kaum ib hlis
Anonim
VBScript Drive Xauv
VBScript Drive Xauv
VBScript Drive Xauv
VBScript Drive Xauv

Hloov tshiab: Tam sim no txoj haujlwm no muaj peev xwm zais cov tsav tsheb uas tau teev tseg

Tom qab ua kuv lub vijtsam xauv uas xauv cov neeg siv computer kuv txiav txim siab los ua qhov nyuaj ntawm kev ua lub xauv tsav uas xauv lub tsav.

Peb txhua tus qee zaum xav kom cov neeg siv tawm ntawm kev tsav tsheb (tshwj xeeb yog tsav USB). Yog li qhov haujlwm no yuav kaw lub tsav kom tiv thaiv cov neeg siv tsis tau tso cai los ntawm kev nkag mus rau nws.

Tsis zoo li kuv lub vijtsam xauv cov ntawv no nyuaj heev. Feem ntau vim tias kuv tau ntxiv ntau yog tias yog thiab tom qab ntawd tsuas yog muab rau txoj haujlwm zoo li kev xav.

Qhov haujlwm no tau ua hauv VBScript Hauv ob peb kauj ruam tom ntej no kuv yuav qhia koj tias kuv ua nws li cas.

Kauj ruam 1: Kuv qhov program…

Kuv qhov program…
Kuv qhov program…

Koj tuaj yeem rub kuv lub Drive Lock hauv qab no:

Nov yog cov ntaub ntawv raw VBScript LINK. Koj yuav tau tshem ib qho ntawm 's' ntawm qhov kawg yog li nws yog 'DriveLock.vbs' lossis qhov koj xav tau ntev npaum li cas nws xaus rau hauv.vbs.

Kauj Ruam 2: Ua Tus Tsav Xauv (ntu 1)

Ua Tus Tsav Xauv (ntu 1)
Ua Tus Tsav Xauv (ntu 1)
Ua Tus Xauv Tsav Tsheb (ntu 1)
Ua Tus Xauv Tsav Tsheb (ntu 1)

Ntawm no kuv yuav qhia koj thawj feem ntawm lub xauv tsav … Thawj daim duab yog dab tsi tshwm sim thaum koj xub pib ua haujlwm.

Kuv tau ua nws yog li koj muaj peb txoj kev xaiv ntawm no, xauv lub tsav tsheb, qhib lub (lossis) tawm.

Tam sim no ntawm no yog qhov kuv tau ua:

Muaj nuj nqi DisplayPrompt () intSplash = MsgBox ("Koj xav ua dab tsi?" & VbCrLf & vbCrLf _ & "[Nyem rau YES txhawm rau xauv lub tsav]" & vbCrLf _ & "[Nyem rau TSIS kom qhib lub tsav (s)] ", 35, cTitleBarMsg) Yog tias intSplash = 2 Tom qab ntawd DisplaySplashScreen () ElseIf intSplash = 7 Tom qab ntawd Yuam Kev Rov Ua Dua Tom ntej objWshShl. RegDelete" HKLM Software Microsoft Microsoft Windows CurrentVersion Policies Explorer Explorer NoViewOnDrive "DejWelSelete / Microsoft / Windows / CurrentVersion / Policies / Explorer / NoDrives "Yog Err. Number 0 Ces MsgBox" Drives twb tau xauv lawm. ", 16, cTitleBarMsg DisplayPrompt () Xaus Yog Yog Yuam Kev Mus 0 obWshShl. Run" Taskkill /f /im explorer.exe ", 0 WScript. Sleep 300 objWshShl. Run" cmd /c explorer.exe ", 0 MsgBox" Drive xauv tau ua tiav! ", 64, cTitleBarMsg DisplayPrompt () Xaus Yog Kawg Ua Haujlwm

Yog tias koj nyem TSIS rau qhib lub tsav (s), nws tshem tawm cov npe yuam sij uas muaj cov teeb tsa uas xauv/zais lub tsav nws tseem kuaj xyuas seb tus tsav puas tau xauv. Tom qab ntawd nws rov pib dua explorer.exe kom cov kev hloov pauv siv tau tam sim ntawd.

Yog tias koj nyem rho tawm, nws qhia txog lub vijtsam tawg thiab tom qab ntawd tawm mus.

Thaum kawg yog tias koj nyem YES ces nws mus rau cov ntawv qhia zaub mov tom ntej. Uas kuv yuav piav qhia hauv qib tom ntej.

Kauj Ruam 3: Ua Tus Tsav Xauv (ntu 2)

Ua Tus Xauv Tsav Tsheb (ntu 2)
Ua Tus Xauv Tsav Tsheb (ntu 2)
Ua Tus Tsav Xauv (ntu 2)
Ua Tus Tsav Xauv (ntu 2)

Tom ntej no kuv yuav qhia koj cov ntawv qhia zaub mov yog koj xaiv tus dab tsav koj xav xauv (pic 1).

Teeb colDrives = objFSO. Drives

Rau Txhua objDrive hauv colDrives strDriveList = strDriveList & objDrive. DriveLetter & Space (10) Tom ntej strDrives = LCase (Hloov (strDriveList, "", ", 1, -1)) Teeb colDrives = objFSO. Drives strDriveList =" "Rau Txhua objDrive hauv colDrives strDriveList = strDriveList & objDrive. DriveLetter & ": \" & Chaw (5) Tom ntej

Tswv yimMenu ()

Sub InputMenu strChoice = InputBox ("Sau tsab ntawv ntawm qhov tsav koj xav kom xauv." & _ "Los yog ntaus TXHUA txhawm rau kaw tag nrho cov tsav." & _ Vbcrlf & vbcrlf & "Muaj tsav" & Chaw (3) & _ ":" & vbCrLf & vbCrLf & strDriveList, cTitleBarMsg)

Thawj qhov ntawm cov cai tsim cov npe ntawm txhua qhov muaj nyob. Ntu tom ntej yog lub npov nkag koj tau nkag mus rau hauv tsab ntawv ntawm lub tsav uas koj xav xauv.

Yog tias koj sim ntaus txhua yam tab sis tsab ntawv tsav siv tau, thiab txoj haujlwm yuav tsis kam nws. Nov yog qhov kuv tau ua li cas:

Yog IsEmpty (strChoice) Tom qab ntawd

DisplaySplashScreen () ElseIf strChoice = "" Tom qab ntawd MsgBox "Tsis txhob tso qhov no tseg.", 16, cTitleBarMsg InputMenu () ElseIf LCase (strChoice) = "tag nrho" Tom qab ntawd 'Tsis Ua Dab Tsi ElseIf Len (strChoice) 1 Tom qab ntawd MsgBox "Koj yuav tsum nkag mus tsab ntawv XWB. ", 16, cTitleBarMsg InputMenu () ElseIf Not InStr (1, strDrives, LCase (strChoice), 1) 0 Ces MsgBox" Xaiv tsis raug, thov sim dua. ", 16, cTitleBarMsg InputMenu () Xaus Yog

Thawj ob kab txheeb xyuas seb tus neeg siv ntaus lub pob rho tawm, thiab yog tias lawv tau ua qhov haujlwm tawm.

Peb kab tom ntej no txheeb xyuas seb tus neeg siv tau tso thaj chaw nkag mus dawb.

Tus so ntawm txoj cai yog qhov tsis meej pem, tab sis nws tsuas yog ua kom ntseeg tau tias tus neeg siv ntaus hauv qhov siv tau.

Kauj Ruam 4: Ua Tus Tsav Xauv (Ntu 3)

Ua Tus Tsav Tsheb Xauv (Ntu 3)
Ua Tus Tsav Tsheb Xauv (Ntu 3)

Vim qee qhov kev sau npe tsis tuaj yeem nyeem tsab ntawv tsav ib leeg, yog li nws yuav tsum muab tso rau hauv tus lej sib xws. Qhov ntawd yog qhov chaws no hauv qab no ua. Yog xav paub ntxiv ntawm no nyem qhov no.

ElseIf strChoice = "a" Tom qab ntawd

intDriveNumber = 1 ElseIf strChoice = "b" Tom qab ntawd intDriveNumber = 2 ElseIf strChoice = "c" Tom qab ntawd intDriveNumber = 4

Thaum tus lej tau teeb tsa tsab ntawv tam sim no tuaj yeem sau rau npe nrog siv tus lej no:

Lwm qhov ntawv, yog qhov haujlwm no sau rau HKLM tsis yog HKCU. HKLM cuam tshuam rau txhua tus neeg siv hloov chaw tsuas yog siv tam sim no ntawm tus neeg siv thiaj li xauv tau zoo dua.

objWshShl. RegWrite "HKLM Software Microsoft Microsoft Windows CurrentVersion Txoj Cai Explorer Explorer NoViewOnDrive", intDriveNumber, "REG_DWORD"

objWshShl. RegWrite "HKLM Software Microsoft Microsoft Windows CurrentVersion Policies Explorer Explorer NoDrives", intDriveNumber, "REG_DWORD"

Kauj ruam 5: Tsav Xauv

Kuv vam tias koj pom cov lus qhia no muaj txiaj ntsig. yog tias koj tsis nkag siab ib feem ntawm qhov no, thov tshaj tawm lus lossis hais qhia kuv.

Thiab thov muab tswv yim rau kuv txog cov teeb meem thiab thov tus nqi. Kuv siv sijhawm ntau ntawm qhov no.

Yog tias koj xav rub tawm cov ntaub ntawv raw vbs, tsuas yog xyuas kom nws tau txais kev cawm nrog.vbs cov ntaub ntawv txuas ntxiv. Lwm qhov zoo tshaj plaws txog nws, yog tias nws tuaj yeem nqa tau yog li koj tuaj yeem khiav nws tawm ntawm lub flash drive thiab koj tsis tas yuav teeb tsa dab tsi.

Pom zoo: