Kommandoraden kommandon (5 / 10 steg)
Steg 5: STÖTTA ~ tillskriva Checker
Nu i VBScript.
utanför om "%1" == "/?" ( om inte existerar () %1 Ange "attribut = % ~ a1" Ange attrib1 =! attribut: ~ 0, 1! ECHO.
SETLOCAL enabledelayedexpansion
ECHO.
ECHO PROP "filepath"
ECHO.
ECHO attribut:
ECHO A - arkiverade
ECHO R - skrivskydd
ECHO H - dolda
ECHO: S - System
ECHO C - komprimerad
ECHO T - tillfällig
ECHO.
Exit /b
)
ECHO finns ingen fil med det namnet.
ECHO.
Exit /b
)
Ange attrib2 =! attribut: ~ 1, 1!
Ange attrib3 =! attribut: ~ 2, 1!
Ange attrib4 =! attribut: ~ 3, 1!
Ange attrib5 =! attribut: ~ 4, 1!
Ange attrib6 =! attribut: ~ 5, 1!
Ange attrib7 =! attribut: ~ 6, 1!
Ange attrib8 =! attribut: ~ 7, 1!
Ange attrib9 =! attribut: ~ 8, 1!
om % attrib1% equ d echo katalog
om % attrib2% equ r echo skrivskydd
om % attrib3% equ ett eko arkiverad
om % attrib4% equ h eko dolda
om % attrib5% equ s eko systemfil
om % attrib6% equ c eko komprimerad fil
om % attrib7% equ o echo Offline filen
om % attrib8% equ t echo temporärfil
om % attrib9% equ l eko Reparse-punkt
Exit /b
Kör det som du skulle något kommando.
" Test om det har körts korrekt. ställa in fso = CreateObjectScripting.FileSystemObject("") ' ge tillgång till filer. "Test för ogiltiga argument, osv... "Göra saker. funktion usage(errorlevel)
om wscript.fullname = "C:\Windows\system32\wscript.exe" då
WScript.Echo "Vänligen använd""cscript /nologo prop.vbs [parametrar]" "att åberopa detta skript".
WScript.quit
slut om
om wscript.arguments.count = 0 då
Usage(1)
annars om wscript.arguments.item(0) = "/?" sedan
Usage(0)
annat om inte fso.fileexists(wscript.arguments.item(0)) sedan
Usage(2)
slut om
slut om
slut om
Ange fil = fso.getfile(wscript.arguments.item(0))
Om filen. Attribut och 0 då
Wscript.Echo "Inga attribut uppsättning."
Slut om
Om filen. Attribut och 1 sedan
Wscript.Echo "Skrivskyddade."
Slut om
Om filen. Attribut och 2 sedan
Wscript.Echo "Dold fil".
Slut om
Om filen. Attribut och 4 sedan
Wscript.Echo "systemfil".
Slut om
Om filen. Attribut och 32 sedan
Wscript.Echo "Arkiv bit uppsättning."
Slut om
Om filen. Attribut och 64 sedan
Wscript.Echo "Länk eller genväg."
Slut om
Om filen. Attribut och 2048 sedan
Wscript.Echo "Komprimerad fil".
Slut om
WScript.Echo "returfilen attribut."
WScript.ECHO
WScript.Echo "användning:"
WScript.Echo "PROP""fil" ""
WScript.ECHO
WScript.quit(ERRORLEVEL)
avsluta funktion