Dir Command (Piv txwv, Options, Switches, & Ntau)

Cov txheej txheem:

Dir Command (Piv txwv, Options, Switches, & Ntau)
Dir Command (Piv txwv, Options, Switches, & Ntau)
Anonim

Cov lus txib dir yog Command Prompt hais kom siv los tso saib cov npe ntawm cov ntaub ntawv thiab cov folders subfolders uas muaj nyob hauv ib lub nplaub tshev.

Rau txhua cov ntaub ntawv lossis cov ntawv teev npe, cov lus txib yuav, los ntawm lub neej ntawd, qhia hnub thiab sijhawm cov khoom tau hloov pauv zaum kawg, yog tias cov khoom yog ib daim nplaub tshev (labeled nrog DIR) lossis cov ntaub ntawv, qhov loj ntawm cov ntaub ntawv yog siv tau, thiab thaum kawg lub npe ntawm cov ntaub ntawv lossis cov ntawv tais ceev tseg suav nrog cov ntaub ntawv txuas ntxiv.

Image
Image

Sab nraum ntawm cov ntaub ntawv thiab cov ntawv teev npe, cov lus txib dir tseem qhia cov ntawv tsav tam sim no ntawm kev faib tawm, cov ntawv ntim ntim, ntim cov naj npawb, tag nrho cov ntaub ntawv teev tseg, tag nrho qhov loj ntawm cov ntaub ntawv hauv bytes, tus lej ntawm subfolders tau teev tseg, thiab tag nrho cov bytes seem dawb ntawm tus tsav.

Dir Command Availability

Cov lus txib dir muaj nyob rau hauv Command Prompt hauv txhua qhov Windows operating systems suav nrog Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, thiab Windows XP.

Image
Image

Cov laus dua ntawm Windows suav nrog cov lus txib dir thiab tab sis nrog ob peb txoj kev xaiv tsawg dua li peb tau teev tseg hauv qab no. Cov lus txib dir kuj yog DOS hais kom ua, muaj nyob rau hauv tag nrho cov versions ntawm MS-DOS.

Cov lus txib dir tuaj yeem pom hauv offline Command Prompt versions, zoo li cov uas muaj los ntawm Advanced Startup Options thiab System Recovery Options. Cov lus txib dir kuj tseem suav nrog hauv Recovery Console hauv Windows XP.

Qhov muaj ntawm qee qhov dir hais kom hloov pauv thiab lwm yam dir hais kom ua syntax yuav txawv ntawm kev khiav haujlwm mus rau kev ua haujlwm.

Dir Command Syntax

dir [tsav :][path][filename] [ /a[ :] cwj pwm] [ /b] [ /c] [ /d] [/l ] [/n ] [/o [:] sortorder] [/p ] [/q ] [/r] [ /s] [ /t[ :] sijhawm] [ /w] [ /x] [ /4

Saib Yuav Ua Li Cas Nyeem Command Syntax yog tias koj tsis paub meej tias yuav txhais li cas cov syntax ntawm dir hais kom ua raws li nws tau sau saum toj no lossis qhia hauv cov lus hauv qab no.

Dir Command Options
piav qhia
drive :, path, filename Nov yog tus tsav, txoj hauv kev, thiab/lossis filename uas koj xav pom cov txiaj ntsig. Tag nrho peb yog xaiv tau txij li cov lus txib tuaj yeem ua tiav ib leeg. Tso cai rau Wildcards. Saib Dir Command Piv txwv tshooj hauv qab no yog tias qhov no tsis meej.

Thaum ua tiav ib leeg, qhov kev hloov pauv no qhia txhua hom ntaub ntawv thiab cov folders, suav nrog cov ntaub ntawv cov yam ntxwv uas feem ntau tiv thaiv lawv los ntawm kev tshwm sim hauv Command Prompt lossis hauv Windows. Siv /a nrog ib lossis ntau tus cwj pwm hauv qab no (colon yog xaiv tau, tsis muaj qhov chaw xav tau) los qhia cov hom ntaub ntawv nkaus xwb hauv cov lus txib:

a=archive files

d=directories

h=zais cov ntaub ntawv

i=tsis cov ntsiab lus indexed cov ntaub ntawv

l=reparse cov ntsiab lus

r=nyeem nkaus xwb cov ntaub ntawv

s=system files

v=kev ncaj ncees cov ntaub ntawv

x=tsis muaj ntaub ntawv nplaum

-=Siv qhov no ua cov lus ua ntej rau ib qho ntawm cov cwj pwm saum toj no kom tshem tawm cov khoom nrog cov ntaub ntawv tus cwj pwm los ntawm cov txiaj ntsig.

/b Siv qhov kev xaiv no los qhia cov txiaj ntsig dir siv "nplua nuj" hom, uas tshem tawm cov ntaub ntawv header thiab footer ib txwm, nrog rau tag nrho cov ntsiab lus ntawm txhua yam khoom, tsuas yog cov npe npe lossis cov ntaub ntawv npe thiab txuas ntxiv.
/c Qhov kev hloov no yuam kev siv ntau txhiab tus cais thaum cov lus txib siv hauv txoj kev uas qhia cov ntaub ntawv loj. Qhov no yog tus cwj pwm tsis zoo ntawm cov khoos phis tawj feem ntau, yog li kev siv tswv yim yog /-c kom lov tes taw txhiab tus cais hauv cov txiaj ntsig.
Siv /d txhawm rau txwv cov khoom tso tawm rau cov folders nkaus xwb (muaj nyob hauv cov kab tuav) thiab cov npe cov ntaub ntawv nrog lawv txuas ntxiv. Cov khoom tau teev saum toj mus rau hauv qab thiab tom qab ntawd hla txhua kab. Standard dir hais kom ua header thiab footer cov ntaub ntawv tseem zoo ib yam.
/l Siv qhov kev xaiv no los qhia tag nrho cov nplaub tshev thiab cov npe cov ntaub ntawv hauv tus lej me.
Qhov kev hloov no ua rau muaj qhov tshwm sim nrog cov kab nyob rau hnub tim > lub sijhawm > directory > cov ntaub ntawv loj > cov ntaub ntawv lossis cov ntawv teev npe kab ke. Txij li qhov no yog tus cwj pwm tsis zoo, kev siv tswv yim yog /-n uas tsim cov kab hauv cov ntaub ntawv lossis lub npe nplaub tshev > directory > cov ntaub ntawv loj > hnub > lub sijhawm xaj.
/o

Siv qhov kev xaiv no txhawm rau txheeb xyuas qhov kev txiav txim rau cov txiaj ntsig. Thaum ua tiav ib leeg, /o sau cov npe ua ntej, ua raws cov ntaub ntawv, ob qho tib si hauv cov ntawv sau. Siv qhov kev xaiv no nrog ib lossis ntau qhov txiaj ntsig hauv qab no (colon yog xaiv tau, tsis muaj qhov chaw xav tau) txhawm rau txheeb cov dir hais kom ua raws li qhov teev tseg:

d=txheeb los ntawm hnub / sijhawm (kawg thawj zaug)

e=txheeb los ntawm txuas ntxiv (alphabetical)

g=pawg directory ua ntej, ua raws cov ntaub ntawv

n=txheeb los ntawm lub npe (alphabetical)

s=txheeb los ntawm qhov loj (tsawg tshaj thawj)

-=Siv qhov no ua qhov ua ntej nrog ib qho ntawm qhov tseem ceeb saum toj no los thim qhov kev txiav txim (-d los txheeb xyuas los ntawm qhov tshiab tshaj plaws ua ntej, -s rau qhov loj tshaj plaws, thiab lwm yam).

qhov kev xaiv no qhia cov txiaj ntsig ib nplooj ntawv ib zaug, cuam tshuam nrog nias ib qho yuam sij txuas ntxiv… sai. Siv /p zoo ib yam li siv cov lus txib dir nrog ntau cov lus txib.
/q Siv qhov hloov pauv no los tso saib tus tswv ntawm cov ntaub ntawv lossis nplaub tshev hauv cov txiaj ntsig. Txoj hauv kev yooj yim tshaj plaws los saib lossis hloov cov ntaub ntawv cov tswv cuab los ntawm Windows yog los ntawm Advanced khawm hauv Security tab thaum saib cov ntaub ntawv Cov Khoom.
/r Qhov /r kev xaiv qhia pom cov ntaub ntawv hloov pauv (ADS) uas yog ib feem ntawm cov ntaub ntawv. Cov ntaub ntawv kwj nws tus kheej tau teev nyob rau hauv kab tshiab, nyob rau hauv cov ntaub ntawv, thiab yog ib txwm suffixed nrog $DATA, ua rau lawv yooj yim rau pom.
/s qhov kev xaiv no qhia tag nrho cov ntaub ntawv thiab cov folders hauv cov ntawv teev npe ntxiv rau tag nrho cov ntaub ntawv thiab cov folders uas muaj nyob rau hauv ib qho subdirectories ntawm cov ntawv teev npe ntawd.
/t

Siv qhov kev xaiv no nrog rau ib qho ntawm qhov tseem ceeb hauv qab no (colon yog xaiv tau, tsis muaj qhov xav tau) los qhia lub sijhawm teb los siv thaum txheeb xyuas thiab / lossis tso tawm cov txiaj ntsig:

a=nkag mus zaum kawg

c=created

w =sau kawg

/w Siv /w los qhia cov txiaj ntsig hauv "wide format" uas txwv cov khoom tso tawm rau cov folders nkaus xwb (muaj nyob rau hauv cov kab ke) thiab cov npe cov ntaub ntawv nrog lawv cov extensions. Cov khoom tau teev tseg sab laug-rau-txoj cai thiab tom qab ntawd hauv kab. Standard dir hais kom ua header thiab footer cov ntaub ntawv tseem zoo ib yam.
/x qhov hloov pauv no qhia tau tias "lub npe luv" sib npaug rau cov ntaub ntawv uas nws lub npe ntev tsis ua raws li cov cai uas tsis yog-8dot3.
/4 Tus /4 hloov yuam kev siv 4 tus lej xyoo. Yam tsawg kawg hauv qhov tshiab ntawm Windows, 4-tus lej xyoo zaub yog tus cwj pwm tsis zoo thiab /-4 tsis ua rau 2-tus lej xyoo zaub.
/? Siv cov kev pab hloov nrog cov lus txib dir los qhia cov ntsiab lus ntawm cov kev xaiv saum toj no ncaj qha rau hauv Command Prompt window. Executing dir /? yog tib yam li siv cov lus txib pab kom ua tiav help dir.

Xav txog qhov ntim ntawm cov ntaub ntawv uas cov lus txib dir feem ntau rov qab los, txuag tag nrho nws rau hauv cov ntawv nyeem los ntawm tus neeg teb xov tooj redirection feem ntau yog lub tswv yim ntse. Saib Yuav Ua Li Cas Redirect Command Output rau Cov Ntaub Ntawv kom paub ntxiv txog yuav ua li cas.

Dir Command Piv txwv

Hauv qab no yog qee txoj hauv kev sib txawv koj tuaj yeem siv cov lus txib dir:

Khiav Tsis Hloov


dir

Hauv qhov piv txwv no, cov lus txib dir yog siv ib leeg, tsis muaj tsav:, txoj hauv kev, cov npe cov ntaub ntawv tshwj xeeb, lossis ib qho kev hloov pauv, ua kom muaj txiaj ntsig zoo li no:


C:\>dir

Volume in drive C has no label.

Volume Serial Number is F4AC-9851 Directory of C:\2015-02-09 12:41 PM $SysReset

2016-30-05 06:22 PM 93 HaxLogs.txt2016-07-05 02:58 AM PerfLogs05/ 22/2016 07:55 PM Program Files2016-31-05 11:30 AM Program Files (x86)2015-30-07 04: 32 PM Temp2016-22-05 07:55 PM Users2016-22-05 08:00 PM Windows

2016-22-05 09:50 PM Windows.old

1 File(s) 93 bytes

Raws li koj tuaj yeem pom, cov lus txib dir raug tua los ntawm cov npe hauv paus ntawm C (piv txwv li, C:\>). Tsis hais qhov twg raws nraim rau sau cov ntawv tais ceev tseg thiab cov ntaub ntawv los ntawm, cov lus txib ua haujlwm rau kev nthuav tawm cov ntaub ntawv no los ntawm qhov chaw ua haujlwm.

List Hidden Items


dir c:\users /ah

Hauv qhov piv txwv saum toj no, peb tab tom thov kom cov lus txib dir qhia tau los ntawm tus tsav: thiab txoj hauv kev ntawm c:\ cov neeg siv, tsis yog los ntawm qhov chaw peb tab tom khiav cov lus txib los ntawm. Peb kuj tseem hais ntxiv, ntawm qhov hloov pauv nrog tus cwj pwm h, uas peb xav pom cov khoom zais, ua rau qee yam zoo li no:


C:\>dir c:\users /ah

Volume in drive C has no label.

Volume Serial Number is F4AC-9851

Directory of c:\users

2016-07-05 04:04 AM Txhua tus neeg siv [C:\ProgramData]

2016-22-05 08:01 PM Default2016-07-05 04:04 AM Default User [C:\Users\Default]2016-07-05 02:50 AM 174 desktop.ini1 File(s) 174 bytes

Daim ntawv teev npe me me thiab cov ntaub ntawv ib leeg uas koj pom hauv cov txiaj ntsig saum toj no tsis ua kom tag nrho ntawm c:\ cov neeg siv nplaub tshev-tsuas yog cov ntaub ntawv zais thiab cov folders. Txhawm rau pom tag nrho cov ntaub ntawv thiab cov folders, koj yuav ua tiav dir c:\users /a (tshem tawm h) hloov.

Nrhiav cov ntaub ntawv hauv ib qho Folder


dir c:\.csv /s /b > c:\users\tim\desktop\csvfiles.txt

Nyob rau hauv qhov no me ntsis nyuaj, tab sis ntau qhov ua tau zoo, piv txwv li rau dir hais kom ua, peb tab tom thov kom peb lub hard drive tag nrho raug tshawb nrhiav CSV cov ntaub ntawv thiab tom qab ntawd cov txiaj ntsig tsawg kawg nkaus tau tawm mus rau cov ntawv nyeem. Wb saib daim no ib daim:

  • c:\.csv qhia dir hais kom saib tag nrho cov ntaub ntawv () uas xaus rau hauv CSV (.csv) txuas ntxiv hauv lub hauv paus ntawm c: tsav.
  • /s qhia kom nws nkag mus tob dua li lub hauv paus ntawm c: thiab hloov pauv, tshawb nrhiav cov ntaub ntawv zoo li no hauv txhua daim nplaub tshev, tob npaum li cov folders mus.
  • /b tshem tawm ib yam dab tsi tab sis txoj hauv kev thiab lub npe ntawm cov ntaub ntawv, qhov tseem ceeb tsim tau "cov npe" ntawm cov ntaub ntawv no.
  • > is a redirection operator, meaning "xa" rau qhov chaw.
  • c:\users\tim\desktop\csvfiles.txt is the destination for the > redirector, txhais tau tias cov txiaj ntsig yuav yog sau rau csvfiles.txt cov ntaub ntawv es tsis yog hauv Command Prompt, uas yuav raug tsim nyob rau ntawm c:\users\tim\desktop qhov chaw (i.e., lub Desktop koj pom thaum koj nkag rau hauv).

Thaum koj hloov pauv cov lus txib tawm mus rau cov ntaub ntawv, raws li peb tau ua ntawm no hauv qhov piv txwv dir no, Command Prompt tsis pom dab tsi. Txawm li cas los xij, qhov tseeb tso zis koj yuav pom yog hloov pauv nyob rau hauv cov ntawv nyeem ntawd. Nov yog qhov peb csvfiles.txt zoo li tom qab dir hais kom ua tiav:


c:\ProgramData\Intuit\Quicken\Innet\merchant_alias.csv

c:\ProgramData\Intuit\Quicken\Innet\merchant_common.csv

c:\Users\All Users\Intuit\Quicken\Innet\merchant_alias.csvc:\Users\All Users\Intuit\Quicken\Int\merchant_common.csvc:\Users\Tim\AppData\Roaming\condition.2.csvc:\Users\Tim\AppData\Roaming\line.csvc:\Users\Tim\AppData\Roaming\media.csv

Thaum koj yeej tuaj yeem hla cov ntaub ntawv hloov pauv, thiab txawm tias qhov hloov pauv "nplua nuj" hloov pauv, cov txiaj ntsig yuav nyuaj heev rau kev ua haujlwm hauv Command Prompt qhov rai, ua rau nws nyuaj rau qhov koj tau ua tom qab.

Cov lus txib sib xws

Cov lus txib dir feem ntau siv nrog cov lus txib del. Tom qab siv dir nrhiav lub npe thiab qhov chaw ntawm cov ntaub ntawv nyob rau hauv ib qho tshwj xeeb folder(s), del tuaj yeem siv los rho tawm cov ntaub ntawv ncaj qha los ntawm Command Prompt.

Zoo ib yam yog rmdir /s hais kom ua, thiab cov lus txib loj dua deltree, siv los rho tawm cov folders thiab cov ntaub ntawv. rmdir hais kom ua (tsis muaj qhov kev xaiv /s) yog qhov tseem ceeb rau kev tshem tawm cov ntawv khoob uas koj pom nrog cov lus txib dir.

Raws li tau hais los saum no, cov lus txib dir kuj tseem siv tau nrog tus neeg teb xov tooj rov qab.

Pom zoo: