windows - unhide usb files batch commands -
i on windows 8.1. usb hidden file/folders. unhide them use attrib command . want run commands inserting usb. pl help.
echo off echo please have patience!!! wait or minimise window!!! rem c:\script\unhide.bat @echo off /f "usebackq tokens=1,2,3,4 " %%i in (`wmic logicaldisk caption^,description^,drivetype 2^>nul`) ( if %%l equ 2 ( echo %%i usb drive. ) ) pause
here got drive letter h. unable use drive letter , use following commands in usb. how can run below commands in usb. mean change drive, run attrib command in usb, delete unwanted files usb , see usb's contents.
cd\ attrib -s -h -r /s /d del *.lnk del thumbs.db del desktop.ini del autorun.inf echo folders has been recovered!!! check folders , files dir pause exit
@echo off setlocal enableextensions echo please have patience!!! wait or minimise window!!! rem c:\script\unhide.bat /f "skip=1 tokens=1-3" %%i in (' wmic logicaldisk "drivetype=2" caption^,drivetype^,systemname ') ( if "%%j"=="2" ( echo "%%i" usb drive ^(drivetype=%%j^). pushd "%%i\" setlocal enabledelayedexpansion echo current folder !cd! endlocal echo attrib -h -s -t /s /d /l >nul 2>&1 echo del *.lnk 2>nul echo del thumbs.db 2>nul echo del desktop.ini 2>nul echo del autorun.inf 2>nul echo folders has been recovered!!! check folders , files dir pause popd ) ) endlocal goto :eof
note:
wmic
command changed follows:where
clause;description
omitted property vary in word number , therefore breaks tokenization;- always non-empty property
systemname
appended pass on ending carriage return in line returned:wmic
behaviour = each output line ends0x0d0d0a
(<cr><cr><lf>
) instead of common0x0d0a
(<cr><lf>
). (general) approach see dave benham'swmic
,for /f
: fix trailing<cr>
problem;
for /f
loop adapted according alteredwmic
command (andskip=1
);- operational
attrib -h -s -t /s /d /l
merelyecho
ed debugging purposes; removeecho
no sooner debugged (the samedel
commands); - used
pushd
-popd
pair:pushd
changes current directory/folder , stores previous folder/path usepopd
command; - folder
system volume information
should keep attributessystem
&hidden
if present.
Comments
Post a Comment