Cov txheej txheem:

Intro to VB Script: Phau Ntawv Qhia Pib: Ntu 2: Ua Haujlwm Nrog Cov Ntaub Ntawv: 13 Kauj Ruam
Intro to VB Script: Phau Ntawv Qhia Pib: Ntu 2: Ua Haujlwm Nrog Cov Ntaub Ntawv: 13 Kauj Ruam

Video: Intro to VB Script: Phau Ntawv Qhia Pib: Ntu 2: Ua Haujlwm Nrog Cov Ntaub Ntawv: 13 Kauj Ruam

Video: Intro to VB Script: Phau Ntawv Qhia Pib: Ntu 2: Ua Haujlwm Nrog Cov Ntaub Ntawv: 13 Kauj Ruam
Video: Наука о данных с Python! Анализ типов файлов от Avro до Stata 2024, Kaum ib hlis
Anonim
Intro to VB Script: Phau Ntawv Qhia Pib: Ntu 2: Ua Haujlwm Nrog Cov Ntaub Ntawv
Intro to VB Script: Phau Ntawv Qhia Pib: Ntu 2: Ua Haujlwm Nrog Cov Ntaub Ntawv

Zoo hauv kuv qhov kev qhia VBScript kawg, Kuv tau hla yuav ua li cas thiaj ua tsab ntawv kaw koj lub internet kom ua si Xbox360. Hnub no kuv muaj teeb meem sib txawv. Kuv lub khoos phis tawj tau kaw lub sijhawm tsis raug thiab kuv xav teev npe txhua lub sijhawm uas lub khoos phis tawj rov pib dua rau hauv cov ntawv. Kuv muaj qhov xav tias qhov teeb meem yog daim npav video tab sis kuv xav kom paub tseeb. Kuv tawm ntawm lub khoos phis tawj txhua lub sijhawm tab sis tsis tuaj yeem saib xyuas nws 24/7, yog li kuv qhov kev daws teeb meem yooj yim tshaj plaws yog sau lub sijhawm thwj rau cov ntawv txhua lub sijhawm nws rov pib dua. Vim tias nws muab BSOD rau kuv txhua lub sijhawm, nkag mus thaum nws kaw yuav nyuaj heev yog li kuv yuav tsum tau txais nws thaum nws rov qab los. Qhov ntawd yog ib qho yooj yim. Tabsis qhov tseeb tias qhov no tsuas yog ib ntus xwb kom txog thaum kuv paub tias lub computer tsis raug dab tsi, kuv yuav tsis sau ntawv mus rau npe lossis ua nws qhov kev pabcuam yog li nws yuav pib thaum lub sijhawm khau raj. Thiab kom nws rov pib dua txhua lub sijhawm nws kaw kuv yuav tsum hloov kho bios.

Kauj ruam 1: Hloov kho Bios kom Tau Txais Nws Rov Pib Dua ntawm Lub Hwj Chim Ua Haujlwm

Hloov kho Bios kom Tau Txais Nws Rov Pib Dua ntawm Lub Hwj Chim Ua Haujlwm
Hloov kho Bios kom Tau Txais Nws Rov Pib Dua ntawm Lub Hwj Chim Ua Haujlwm

Kuv tsis paub tseeb tias kuv qhov teeb meem yog nrog lub hwj chim ua tsis tiav lossis nrog kuv daim npav video lossis nws yog dab tsi. Tab sis kuv paub tias lub khoos phis tawj rov pib dua txhua zaus. Yog li kom paub tseeb tias nws rov pib dua tom qab lub hwj chim tsis ua haujlwm (IE: lub hwj chim muab xim av tawm) Kuv xav hloov kho bios. Vim tias muaj ntau ntau tus tsim bios sib txawv nyob rau ntawd, nws yuav nyuaj rau sau txhua txoj hauv kev sib txawv los ua qhov no hauv txhua qhov sib txawv bios cov ntxaij vab tshaus yog li kuv tsuas yog muab cov hauv paus thiab qhia rau koj paub Qhov tshwj xeeb ntawm koj tus kheej. Hauv paus nkag mus rau hauv koj li bios koj yuav tsum tau nyem lub pob ntawm khau raj. Feem ntau nws yuav hais qee yam xws li "ntaus Del kom nkag mus teeb" lossis "F2". Cov tuam txhab sib txawv muab txoj hauv kev sib txawv rau koj tab sis feem ntau nws yog "F2" lossis "Del" qhov tseem ceeb. Ib qho twg los saib nws thiab ntaus tus yuam sij nws qhia koj kom ntaus. Tam sim no koj yuav los rau ntawm lub vijtsam uas feem ntau yog grey lossis xiav, tab sis ntxiv nws nyob ntawm koj li bios ua. Koj yuav tab tom nrhiav lub zog teeb tsa kev xaiv. Nws yuav yog ntawm lub qhov rais tag nrho nws tus kheej zoo li hauv AMIBIOS lub vijtsam txhaj tshuaj (qiv los ntawm toms kho vajtse qhia) lossis qee qhov nws yuav yog nyob rau hauv qib siab bios nta qhov rai. Xijpeem koj tab tom nrhiav rau "rov qab rau ac/lub zog poob" teeb tsa. Tej zaum nws yuav muaj npe lwm yam tab sis nws yuav nyob ze rau qhov ntawd. Tsuas yog nrhiav nws. Feem ntau nws yuav muaj peb txoj kev xaiv (lub xeev kawg, tom qab lub zog poob, tawm tom qab lub zog poob). Koj xav teeb nws rau tom qab lub zog poob. Nco ntsoov tias koj txuag koj cov chaw thiab tawm ntawm bios. Tam sim no thaum koj lub zog tsis ua lossis koj tshem lub tshuab nws yuav rov pib dua sai li sai tau thaum nws tau txais lub zog rov qab. Ya hhhhhhhhh !!!!!!!!!!!!!!!!!!

Kauj Ruam 2: Sau Tsab Ntawv Ntu 1: Ua Lub Tswv Yim

Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim
Sau Tsab Ntawv Tshooj 1: Ua Lub Tswv Yim

Thawj yam peb xav ua yog tsim phiaj xwm. Peb xav kom tsab ntawv ua dab tsi raws li A.) Thaum lub zog tsis ua haujlwm lossis BSOD los txog peb xav kom nws rov pib dua. (Saib xyuas hauv qib 1 Kho qhov BiosB.) Sai li sai tau nws rov pib dua peb xav sau rau hauv cov ntaub ntawv hnub tim thiab lub sijhawm nws rov pib dua. C.) Peb xav kom tuaj yeem hloov kho cov ntaub ntawv ntawd. Yog tias nws rov pib dua ntau dua ib zaug peb yuav tsis paub D.) Peb xav kom nws kho qhov yuam kev yog li nws yuav tsis ntsia hlau thiab peb paub tseeb tias peb tau txais tag nrho peb cov reboots yam tsis muaj qhov ploj vim qhov tsis zoo coding. E.) Peb xav tau nws kom qhib cov lus hais tias nws rov pib ua haujlwm F.) Peb xav kom nws qhib cov ntawv peb tau sau rau kom peb tuaj yeem pom cov npe ntawm txhua qhov pib dua thaum peb nyem ok ntawm cov lus pop up.

Kauj Ruam 3: Sau Tsab Ntawv Ntu 2: Tsim Koj Tsab Ntawv Tshaj Tawm Qhov Hloov Pauv

Sau Tsab Ntawv Tshooj 2: Tsim Koj Cov Ntawv Sau Npe rau Cov Cuam Tshuam
Sau Tsab Ntawv Tshooj 2: Tsim Koj Cov Ntawv Sau Npe rau Cov Cuam Tshuam

Ok thawj yam ua ntej, tsim cov ntawv sau thiab hloov nws mus rau any_name.vbs. Kuv siv shutdown_catcher.vbs tab sis koj tuaj yeem siv txhua yam. Tam sim no tsuas yog nyem rau vbs cov ntawv thiab ntaus ntawv kho kom raug. yuav tsum saib mus rau nws. Ok tam sim no thawj yam peb xav ua yog tsim cov lej. Cov ntawv hloov pauv yog qhov cia li yog tus tuav lub chaw yog li peb tsis tas yuav sau tag nrho cov khoom ib pawg ua ke. piv txwv: peb muaj kab lus uas hais tias "hma liab xim av nrawm dhau ntawm cov dev tub nkeeg rov qab". tab sis nws nyob hauv peb cov cai 20 zaug. peb tuaj yeem sau tawm tag nrho kab lus 20 zaug lossis tsim qhov sib txawv thiab muab kab lus rau qhov sib txawv ntawd Yog li hauv qhov piv txwv no peb tsim qhov sib txawv strSentence ces muab "hma liab xim av nrawm dhia hla cov dev tub nkeeg rov qab" rau qhov sib txawv. Tam sim no txhua yam peb yuav tsum ua yog ntaus strSentence txhua lub sijhawm peb xav tau kab lus thiab nws paub ntaus "hma liab xim av nrawm dhau tus dev tub nkeeg rov qab" peb yuav ua li cas: Yog tias peb muaj ntau yam sib txawv ntawm tib hom peb tuaj yeem tso tau lawv ntawm tib txoj kab thiab cais qhov sib txawv los ntawm tus lej. Txhawm rau tsim qhov sib txawv peb yuav tsum ua dab tsi hu ua dimensioning qhov sib txawv. Txhawm rau ua qhov no peb ntaus Dim ua ntej qhov sib txawv ces peb muab cov ntawv ua ntej ntawm qhov sib txawv kom peb paub tias qhov sib txawv nruab nrab yog dab tsi. Piv txwv yog str rau txoj hlua sib txawv ob qho tib si rau cov khoom sib txawv const rau qhov tas mus li…. Cov npe mus ntxiv thiab txuas ntxiv. cov no yog cov uas peb yuav siv hauv tsab ntawv no yog li kuv yuav piav qhia lawv me ntsis. ib txoj hlua feem ntau yog ntawv zoo li kab lus. Ib yam khoom feem ntau yog qee yam ntawm lub cev xws li cov ntawv lossis cov haujlwm. NCO NTSOOV: Txhua Lub Sij Hawm Ib Kab Muaj Ib Leeg 'Ua Ntej Nws Txoj Kab Yuav Tsis Nkag Los Ntawm Cov Ntawv Sau. THEY YUAV TSUM MUAJ LUS QHUAB QHIA QHOV TSEEB thiab muab tso rau hauv Lawv YUAV TSUM NCO NTSOOV lawv ua dab tsi tom qab thaum rov tshuaj xyuas cov lej. Kuv yuav siv lawv los ua cov lus hais txog CODE yog li koj tuaj yeem pom vim li cas kuv thiaj ua txhaum txoj kev uas kuv tau ua. THIAB Lawv YUAV TSUM TAU SAWV DAWS TUS NEEG LINE Lawv YUAV TSUM TAU TXAIS NTXIV. Tsis muaj nws ib qho tsis tau hloov pauv yuav raug kho raws li qhov objectOption Explicit'now peb tsim 5 qhov sib txawv rau cov ntawv tais ceev tseg thiab cov ntaub ntawv peb yuav xav tau 'npe lawv li cas koj xav tau tab sis lub rooj sib tham yog preNameDim objFiSyOb, objSysFold, objShell, objFile, objTextFile'now peb xav tau los tsim cov hlua sib txawv rau cov npe, cov ntaub ntawv thiab cov ntaub ntawv npeDim strDir, strFile, strFileName'now muab cov txiaj ntsig rau qhov sib txawv 'strDir yog peb cov npe peb xav tau daim nplaub tshev hauv strDir = "C: / Catcher"' strFile yog qhov peb xav tau cov ntawv sau thiab dab tsi nws yog lub npestrFile = "\ Shutdown_catcher.txt" 'lub strfile lub npe yog li peb muaj lub npe ntawm cov ntawv siv rau hauv pop upsstrFileName = "Shutdown_catcher.txt"' tom ntej no peb yuav tsum tau muab qhov tsis tu ncua rau kev nkag mus rau cov ntaub ntawv peb muaj peb txoj kev xaiv 'peb tsuas yog siv cov ntawv txuas ntxiv hauv cov cai no tab sis nws yog qhov zoo kom paub txhua tus ntawm lawv. Const forReading = 1, forWriting = 2, ForAppending = 8'lastly peb xav tau teeb tsa qhov sib txawv rau cov kab ke yog li peb tuaj yeem hu nws tom qab thaum peb xav tau nwsSet objFiS yOb = CreateObject ("Scripting. FileSystemObject")

Kauj Ruam 4: Kev piav qhia nyob nruab nrab

Kev piav qhia nyob nruab nrab
Kev piav qhia nyob nruab nrab

Tam sim no uas peb muaj peb qhov kev hloov pauv txhua qhov peb yuav tsum tau ua yog rov nco qab qhov sib txawv tshwj xeeb txhua lub sijhawm. Qhov no tsis yog tsuas yog txo tus nqi ntawm kev ntaus peb ua tab sis kuj tsim tsawg dua qhov ua yuam kev vim sau yuam kev. & strFile, ForAppending, True) 'sau kab ntawv tshiab rau hauv fileobjTextFile. WriteLine ("Koj lub computer Kaw rau" & hnub tim & "ntawm" & sijhawm)' kaw cov fileobjTextFile. Close'make pop upWscript. Echo ("Koj Khoos phis tawj Kaw rau "& hnub tim &" ntawm "& sijhawm) 'qhib cov ntawv hauv IESet objShell = CreateObject (" WScript. Shell ") objShell.run (" Explorer "&" & strDir & "\ shutdown_catcher.txt") Qhov teeb meem yog nws yuav tsis muaj kev kho yuam kev, thiab ib qho yuam kev yooj yim zoo li cov ntaub ntawv tsis muaj lossis hloov pauv uas twb tau muab lawm yuav tsoo tsab ntawv.

Kauj Ruam 5: Sau Tsab Ntawv Ntu 3: Yog Yog Li Cov Lus Hais Raws Li Kev Kho Tsis raug

Sau Tsab Ntawv Ntu 3: Yog Yog Li Cov Lus Hais Raws Li Kev Kho Tsis raug
Sau Tsab Ntawv Ntu 3: Yog Yog Li Cov Lus Hais Raws Li Kev Kho Tsis raug

Txoj hauv kev yooj yim tshaj plaws los kho kev ua yuam kev yog siv yog/tom qab ntawv. Lub hauv paus yog yog tom qab ntawv hais tias yog tias muaj qee yam tshwm sim ces ua qhov no los tsis ua li ntawd. Los ntawm zes yog/tom qab ntawv koj tuaj yeem tsim txoj hlua ntawm yam uas yuav tsum tshwm sim. Yog tias a thiab b thiab c tshwm sim ces ua qhov no ntxiv ua qhov.example: peb xav kom ntseeg tau tias cov ntawv peb xav sau rau yog muaj yog tias peb pom nws peb xav ua dab tsi yog tias peb tsis pom nws peb xav tsim nws lossis peb xav txheeb xyuas yog tias daim nplaub tshev nyob ntawd thiab yog tias tsis tsim nws thiab tom qab ntawd txheeb xyuas yog tias cov ntawv nyob ntawd ib zaug peb pom daim nplaub tshev thiab yog tias tsis tsim nws thawj qhov yog piv txwv ntawm yog tias tom qab ntawv nqe ob yog zes yog tom qab ntawd. peb ua nws: muaj plaub ntu rau ib qho yog tias tom qab ntawv yog/tom qab ntawd saib yog tias nws yog qhov tseeb yog qhov no yog qhov tseeb ces ua qhov no tsis tas li ntawd ua qhov ntawd tom qab xaus cov lus hais kom raug coded yog tias tom qab ntawv yuav yog: Yog ib yam = qee yam Koj yuav tsum ua dab tsi Ua lwm yam ntxiv Yog tias koj tuaj yeem siv kev sib cav tsuav nws yog qhov tseeb nws yuav ua raws li ntu ntawd thiab tsis quav ntsej lwm qhov ntxiv tab sis yog tias nws yog qhov tsis tseeb nws yuav hla qhov ntawd thiab mus rau lwm qhov Tom qab ntawd thaum peb xaus cov lus peb muab "xaus yog", tab sis yog tias peb tau zes yog cov nqe lus peb yuav tsum xaus txhua qhov yog tias nqe lus. Nws yuav xaus lawv los ntawm menyuam yaus mus rau niam txiv yog li thawj "kawg yog" xaus qhov yog cov lus hauv niam txiv, qhov twg qhov thib ob xaus qhov qub (niam txiv) yog nqe lus. peb xav hais hauv cov lus ") txhawm rau ntxiv tus nqi hloov pauv rau hauv nws peb muab tso rau sab nraud lossis nyob nruab nrab ntawm ob nqe lus siv tus cim ampersand (&) kos npe ua tus lej cim kom tus ntawv paub nws yog qhov sib txawv thiab tsis yog ntawv nyeem. zoo li no: Wscript. Echo ("Blah blah blah" & strDir & "blah blah blah" & strFilename & "blah blah blah.") Cov zis yuav yog pop up uas hais tias Blah blah blah C: / Catcher blah blah blah blah shutdown_catcher.txt blah blah blah. Actual Usage: 'yog tias daim nplaub tshev C; muaj nyob Yog tias objFiSyOb. FolderExists (strDir) Tom qab ntawv xaiv cov khoom Teeb objSysFold = objFiSyOb. GetFolder (strDir)' txwv tsis pubElse'create daim nplaub tshev c; CreateFolder (strDir) 'thiab tshawb xyuas seb puas muaj cov ntawv thiab cov ntawv tais ceev tseg Yog tias obfiSyOb. FileExists (strDir & strFile) Then'if nws tau txais nplaub tshev c: / catcher Set ob jSysFold = objFiSyOb. GetFolder (strDir) 'elseElse'create text document shutdown_catcher.txt Set objFile = objFiSyOb. CreateTextFile (strDir & strFile)' tom qab ntawv sau cov lus hais tias koj tau tsim lawv ob qho Wscript. Echo ("Peb tau tsim daim nplaub tshev lub npe "& strDir &" thiab cov ntaub ntawv npe "& strFilename &" thiab muab tso rau hauv "& strDir & strFile &" phau ntawv teev npe. ") 'kawg zes yog daim ntawv hais qhia End Yog tias yog thawj daim ntawv qhia Yog tias Yog tam sim no yog thawj nqe lus peb twb tau tshuaj xyuas daim nplaub tshev thiab pom nws tam sim no peb tau tshuaj xyuas fileIf objFiSyOb. FileExists (strDir & strFile) Tom qab ntawv 'yog pom tau txais daim nplaub tshev teeb objSysFold = objFiSyOb. GetFolder (strDir)' txwv tsis pub lwm tus tsim cov ntawv doc Teeb objFile = objFiSyOb. CreateTextFile (strDir & strFile) 'tsim cov ntawv popup hais tias peb tsim cov ntawv sau Wscript. Echo ("Peb tau tsim cov ntaub ntawv npe" & strFileName & "hauv" & strDir & "file folder.") Xaus Yog

Kauj Ruam 6: Kev piav qhia nyob nruab nrab

Kev piav qhia nyob nruab nrab
Kev piav qhia nyob nruab nrab

Yog tias koj saib zoo ntawm cov cai los ntawm cov kauj ruam dhau los koj yuav pom ob qho tib si zes thiab tsis-zes yog tom qab ntawv. Thawj qhov yog nqe lus zes. Nws tshawb xyuas daim nplaub tshev thiab cov ntawv thiab yog tias tsis pom lawv tsim ob qho tib si. Qhov thib ob zoo li tsuas yog cov ntawv thiab yog tias nws tsis pom nws tsim tsuas yog cov ntawv. Ib tus tuaj yeem hais tias vim li cas ob leeg. Zoo li cas tshwm sim yog tias cov ntaub ntawv raug tshem tawm tab sis daim nplaub tshev tsis yog. Thawj yog cov lus yuav hla txoj cai hla kev tsim cov ntaub ntawv vim tias nws pom cov ntawv tais ceev tseg thiab yuav tsis ua haujlwm lwm qhov ntawm nqe lus. Yog li thaum koj mus sau rau hauv cov ntawv nws yuav yuam kev tawm vim tias cov ntawv yuav ploj. Yog li los ntawm muaj qhov thib ob nyob ntawd nws daws qhov teeb meem no. Txuj ci koj tuaj yeem siv nqe lus zes tawm vim tias nws yuav luag zoo ib yam li qhov thib ob yog tom qab ntawv tab sis tom qab ntawd koj tsuas yog muaj ib qho pop tuaj thiab nws yuav tsis yog tus neeg zoo ntxiv rau nws muab sijhawm rau kuv los qhia koj zes ua tsis raws li -nested yog cov nqe lus.

Kauj Ruam 7: Kev Ua Yuam Kev Ntxiv

Kev Ua Yuam Kev Ntxiv
Kev Ua Yuam Kev Ntxiv

Tam sim no peb tau ua tiav feem ntau ntawm kev kho qhov yuam kev peb xav sau rau hauv cov ntawv thiab qhia cov ntawv pop. Qhov teeb meem yog peb yuav tau txais kev tso cai yuam kev yog tias peb tsis tso tawm qhov kev siv ntawm cov khoom yav dhau los khaws cia hauv qhov sib txawv. Yog li peb xav muab tso rau hauv cov ntawv me me ntawm cov cai uas hais tias teeb tsa qhov sib txawv rau tsis muaj dab tsi. Saib zoo li no: teeb tsa objFile = nothingset objSysFold = tsis muaj dab tsi Yog li rau cov ntawm koj ua raws hauv tsev koj cov cai mus rau qhov no yuav tsum yog (Kuv coj cov lus pom tawm): Option ExplicitDim objFiSyOb, objSysFold, objShell, objFile, objTextFileDim strDir, strFile, strFileNamestrDir = "C: / Catcher" strFile = "\ Shutdown_catcher.txt" strFileName = "Shutdown_catcher.txt," ForAppending = 8Set objFiSyOb = CreateObject ("Scripting. FileSystemObject") Yog objFiSyOb. FolderExists (strDir) Then Set objSysFold = objFiSyOb. GetFolder (strDir) Else Set objSysFold = objFiSyOb. CreateFir Teeb objSysFold = objFiSyOb. GetFolder (strDir) Lwm yam teeb tsa objFile = objFiSyOb. CreateTextFile (strDir & strFile) Wscript. Echo ("Peb tau tsim cov ntawv tais ceev tseg" & strDir & "thiab cov ntaub ntawv npe" & strFilename & "thiab muab tso rau hauv the "& strDir & strFile &" directory. ") Xaus Kuv fEnd IfIf objFiSyOb. FileExists (strDir & strFile) Tom qab ntawd teeb objSysFold = objFiSyOb. GetFolder (strDir) Lwm Yam teeb tsa objFile = objFiSyOb. CreateTextFile (strDir & strFile) Wscript. Echo ("Peb tau tsim cov ntaub ntawv npe" & "& strDir &" file folder. ") Xaus Ifset objFile = nothingset objSysFold = tsis muaj dab tsi

Kauj Ruam 8: Sau Tsab Ntawv Ntu 4: Teeb Tus Cwj Pwm

Sau Tsab Ntawv Tshooj 4: Teeb Tus Cwj Pwm
Sau Tsab Ntawv Tshooj 4: Teeb Tus Cwj Pwm

Tam sim no peb yuav tsum teeb tsa tus yam ntxwv rau hauv cov ntawv yog li peb tuaj yeem hloov kho nws. Yav dhau los peb teeb tsa peb qhov hloov pauv tsis tu ncua: forReading = 1forWriting = 2 forAppending = 8if yog tias koj teeb nws rau rauReading koj yuav tuaj yeem nyeem nws tab sis tsis sau rau nws.if koj teeb nws rau rau Sau koj yuav rov sau dua cov ntawv uas twb muaj lawm txhua zaus koj ua haujlwm. Yog tias koj teeb tsa nws rau Kev Them Nyiaj Koj yuav ntxiv kab tshiab txhua lub sijhawm ntawv sau ua cov ntawv. Txij li thaum peb xav tau ib lub cav ntawm txhua lub sijhawm nws rov pib dua peb xav kom nws txuas ntxiv thiab tsis dhau sau ntawv peb siv rau Kev Them Nyiaj Li Cas.: koj yuav tsum sau lub hom phiaj uas koj xav teeb tsa tus cwj pwm. Txij li peb tau ua tiav feem ntau ntawm cov haujlwm hauv cov kauj ruam dhau los peb tsuas yog xav tau rov qab hloov pauv ntawm qhov no. Tom qab ntawv tsuas yog teeb tsa nws kom raug. Siv qhov tseeb: 'yam khoom teeb tsa = filesystemobject.action (cov npe+npe ntawm cov ntaub ntawv, tus cwj pwm, muaj tseeb lossis tsis tseeb) Teem objTextFile = objFiSyOb. OpenTextFile (strDir & strFile, RauAppending, Tseeb)

Kauj Ruam 9: Sau Tsab Ntawv Tshooj 5: Sau rau Cov Ntaub Ntawv

Sau Cov Ntawv Tshooj 5: Sau rau Cov Ntaub Ntawv
Sau Cov Ntawv Tshooj 5: Sau rau Cov Ntaub Ntawv

Sau ntawv rau ib daim ntawv yog ntau yam zoo li sau pop up. Koj tsuas yog muab: objTextFile. WriteLine ("Xijpeem koj xav hais" & Hloov pauv kom rub los sau kab) Qhov sib txawv tsuas yog thawj ntu. SauLineAnd hauv kab ntawv koj yuav tsum kaw kab ntawv kom nws paub kom tsis txhob sau ntawv thiab rau qhov koj siv: objTextFile. CloseActual Usage: objTextFile. WriteLine ("Koj lub computer Kaw rau" & hnub & "ntawm" & sijhawm) objTextFile.close'now ntxiv hauv qhov popup hais tias koj sau rau hauv daim ntawv kom tus neeg paub nws tshwm sim 'thiab lawv yuav tsum kaw nws kom qhib cov ntawv thiab viewWscript. Echo ("Koj lub computer Kaw rau" & hnub tim & "ntawm" & sijhawm)

Kauj ruam 10: Sau Tsab Ntawv Ntu 5: Qhib Cov Ntaub Ntawv rau Saib

Sau Tsab Ntawv Tshooj 5: Qhib Cov Ntaub Ntawv rau Saib
Sau Tsab Ntawv Tshooj 5: Qhib Cov Ntaub Ntawv rau Saib

Tsab ntawv yuav nyob ntawm qhov no kom txog thaum ib tus neeg nyem qhov pop up. Thaum koj tau dhau los pop tuaj koj tuaj yeem tso kab nyob rau hauv uas qhib cov ntawv. Siv qee qhov kev kho yuam kev ntawm nws pab ua kom txoj haujlwm ua haujlwm tau zoo. Thaum koj tsim qhov yuam kev hauv vbscript, nws ntxiv tus nqi rau "err.number" qhov sib txawv uas yog qhov ua ntej tau piav qhia hauv vbscript. Koj tsis tas yuav txhais nws thiab tuaj yeem siv nws ib yam li lwm qhov sib txawv tsuav koj tsis ua txhaum nws cov cai. Tus nqi muab rau tus lej tsis sib xws yog tus lej rau qhov ua yuam kev uas tshwm sim. Tam sim no koj tuaj yeem tshawb xyuas txhua qhov yuam kev paub hauv vbscript database thiab xyuas kom nws tsis tshwm sim. Los yog yooj yim dua, tsuas yog txheeb xyuas qhov tseeb kom paub meej tias qhov yuam kev tsis yog tus lej. yog tias nws tsis muaj qhov yuam kev tshwm sim. Txhawm rau ua qhov ntawd peb tsuas yog tshuaj xyuas seb qhov sib txawv sib npaug li vbEmpty. Yog li hauv peb tsab ntawv peb xav siv lwm qhov yog tom qab ntawv tshaj tawm. Thiab txheeb xyuas seb puas muaj qhov yuam kev tshwm sim thiab yog tias nws tsis qhib cov ntaub ntawv rau saib, tab sis yog tias nws tau tshwm sim tom qab ntawv nrog cov lej yuam kev hauv nws yog li peb tuaj yeem debug. Then thaum peb ua tiav nrog peb tsab ntawv peb ntaus Wscript. Quit. Qhov no qhia tsab ntawv kom txiav nws tus kheej. Qhov no yuav pab ua kom lub cim xeeb xau thiab cov txheej txheem tsis xav tau ua haujlwm li cas. Nws siv li cas: yog yuam kev tus lej yog sib npaug rau vbEmpty tom qab ntawd tsim lub plhaub tom qab ua haujlwm qhov program los ntawm lub plhaub plawg ib sab popup cov lus hais tias muaj qhov tsis raug yog. errorsIf err.number = vbEmpty then'if none create a shell Set objShell = CreateObject ("WScript. Shell") 'ces qhib cov ntaub ntawv los ntawm lub plhaub uas siv explorer. nws yuav qhib tiag tiag hauv IE txawm hais tias objShell.run ("Explorer" & "" & strDir & "\ shutdown_catcher.txt") 'txwv tsis pub nthuav tawm cov lus nrog tus lej yuam kevElse WScript.echo "VBScript Error:" & err.numberEnd Yog 'xaus scriptWscript.quit

Kauj Ruam 11: Tau Txais Tsab Ntawv Los Ua Haujlwm Thaum Pib

Tau txais tsab ntawv los khiav ntawm Startup
Tau txais tsab ntawv los khiav ntawm Startup

Muaj cov ntawv tais ceev tseg hauv cov ntawv qhia zaub mov hu ua Startup. Txhua yam tso rau hauv daim nplaub tshev no yuav pib sai li sai tau thaum lub khoos phis tawj tau pib. Los ntawm kev tso cov ntawv sau rau hauv daim nplaub tshev pib nws yuav ua txhua lub sijhawm lub khoos phis tawj tau rov pib dua txawm tias txhob txwm ua lossis tsis yog. Txij li thaum kuv tsuas yog siv qhov no los ua cov cuab yeej kuaj mob, nws tsis tas yuav ua rau qhov kev pabcuam pib, thiab kuv tsis tas yuav muab nws tso rau hauv npe kom pib nws, yog li qhov no yuav zoo. Thaum kuv kho lub khoos phis tawj kuv tuaj yeem tshem tawm cov ntawv los ntawm daim nplaub tshev pib thiab tsis muaj lwm yam kev ntxuav yuav tsum tau ua.

Kauj ruam 12: Khiav qhov program

Khiav qhov Program
Khiav qhov Program
Khiav qhov Program
Khiav qhov Program
Khiav qhov Program
Khiav qhov Program

Thaum koj ua tiav vbscript cov ntaub ntawv nws yuav tam sim no A.) Txheeb xyuas seb daim nplaub tshev C: / Catcher muaj thiab yog tias tsis tsim nws.) Yog tias nws tsim ob daim nplaub tshev lossis cov ntawv lossis ob qho tib si nws yuav nthuav tawm cov lus hais tias nws tau tsim lawv (Nco tseg: nws yuav tsum tsuas yog ua qhov no ntawm thawj zaug tom qab ntawd nws yuav tsum tau nyob ntawd tshwj tsis yog tshem tawm yog li koj tsuas yog pom cov lus ntawd ib zaug. Nws yuav yog lub tswv yim zoo los khiav tsab ntawv no ib zaug nyob rau hauv kev tswj hwm rov ua haujlwm yog li koj tuaj yeem hla dhau cov pop no lossis koj yuav tsis sau dab tsi rau hauv cov ntawv vim tias nws yuav hla dhau cov ntawv tsim pop ups.) D:) Sau kab hauv Cov ntawv sau Shutdown_Catcher.txt hais tias lub khoos phis tawj kaw rau lub sijhawm ntawd thiab lub sijhawm zoo li no thiab lub sijhawm zoo li no. koj yuav pom cov cai raws li sau ntawv. Tam sim no txhua yam kuv yuav tsum tau ua yog zaum rov qab thiab tos. Txhua zaus lub khoos phis tawj rov pib dua kuv yuav muaj cov ntaub ntawv kaw tseg. Tom qab ntawd kuv tuaj yeem tshuaj xyuas cov ntaub ntawv thiab saib yog muaj qhov sib xws rau nws. Piv txwv yuav yog nws rov pib dua txhua ib nrab teev lossis nws rov pib dua txhua lub sijhawm uas muaj qhov nce ntxiv lossis 45 ntawm lub moos. Qhov no tsis yog los ntawm ib txoj kev uas kuv tab tom tshawb xyuas hauv computer, tsuas yog li koj paub. Kuv kuj tseem muaj qhov kev ntsuas ntsuas ua haujlwm txhawm rau ntsuas lub sijhawm yog li kuv paub tias nws kub npaum li cas thaum nws kaw, qhov hluav taws xob yog li kuv paub yog tias lub hwj chim tsis ua hauj lwm, thiab ob peb lwm yam pab tau. Zoo kuv vam tias qhov no muaj txiaj ntsig. Kuv paub kuv txaus siab rau nws yog li tej zaum lwm tus yuav zoo ib yam. Yog tias koj muaj lus nug xav nug dawb. Kuv yuav tsis mus rau lawv tam sim tab sis nrog me ntsis thiab kuv yuav teb koj. Nyob ntawm seb kuv hnub/lub lim tiam ua li cas.

Kauj Ruam 13: Txoj Cai

Txoj Cai
Txoj Cai

Nov yog tus lej raws li tau sau yam tsis muaj kev qhia thiab kev hais lus_Option ExplicitDim objFiSyOb, objSysFold, objShell, objFile, objTextFileDim strDir, strFile, strFileNamestrDir = "C: / Catcher" strFile = "\ Shutdown_catcher.txt" strFileName = Const forReading = 1, forWriting = 2, ForAppending = 8Set objFiSyOb = CreateObject ("Scripting. FileSystemObject") Yog objFiSyOb. FolderExists (strDir) Ces teeb objSysFold = objFiSyOb. GetFolder (strDir) Else Set obj objFiSyOb. FileExists (strDir & strFile) Tom qab ntawd teeb objSysFold = objFiSyOb. GetFolder (strDir) Lwm Yam Teeb objFile = objFiSyOb. CreateTextFile (strDir & strFile) Wscript. Echo ("Peb tau tsim cov npe hu ua" & strDir & "thiab cov ntaub ntawv "& strFilename &" thiab muab tso rau hauv "& strDir & strFile &" phau ntawv teev npe. ") Xaus IfEnd IfIf objFiSyOb. FileExists (strDir & strFile) Tom qab ntawd teeb objSysFold = objFiSyOb. GetFolder (strDir) Lwm Yam Teeb objFile = objFiSyObile strDir & strFile) Wscript. Echo ("Peb muaj tsim cov ntaub ntawv hu ua "& strFileName &" hauv "& strDir &" file folder. ") Xaus Ifset objFile = nothingset objSysFold = nothingSet objTextFile = objFiSyOb. OpenTextFile (strDir & strFile, ForAppending, True) objTextFile. WriteLine (" Koj lub computer) Kaw rau "& hnub tim &" ntawm "& sijhawm) objTextFile. CloseWscript. Echo (" Koj lub computer Kaw rau "& hnub tim &" ntawm "& sijhawm) Yog err.number = vbEmpty ces teeb objShell = CreateObject (" WScript. Plhaub ") objShell.run (" Explorer "&" "& strDir &" / shutdown_catcher.txt ") Lwm WScript.echo" VBScript Error: "& err.numberEnd IfWScript. Quit

Pom zoo: