Wednesday, 29 August 2018

Batch File To Delete Temporary Files Windows 10

@ECHO off 
DEL /F /S /Q %TEMP%

cd C:\Users\%username%\AppData\Local
 rmdir /S /Q Temp

del C:\Windows\Prefetch\*.* /Q

del C:\Windows\Temp\*.* /Q

del C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Recent Items*.* /Q

Connect To SVN Command Batch File

CMD /c nslookup SERVER.ABC.local
CMD /c pathping SERVER.ABC.local

pause

Batch File To Clear ALL Browsers Cookies & History

@echo off

rem IE
taskkill /F /IM iexplore.exe
start "" "C:\Windows\System32\rundll32.exe" InetCpl.cpl,ClearMyTracksByProcess  255

:: Parse the Local AppData sub path
call :Expand xAppData "%%LocalAppData:%UserProfile%=%%"

set "xFirefox=\mozilla\firefox\profiles"
set "xChrome=\google\chrome\user data"

:: Start at the User directory
pushd "%UserProfile%\.."

taskkill /F /IM firefox.exe
taskkill /F /IM chrome.exe

:: Loop through the Users
    for /D %%D in (*) do if exist "%%~fD%xAppData%" (
    rem Check for Firefox
    if exist "%%~fD%xAppData%%xFirefox%" (
        rd /s /q "%%~fD%xAppData%%xFirefox%"
    )

   rem Check for Chrome
   if exist "%%~fD%xAppData%%xChrome%" (
        rd /s /q "%%~fD%xAppData%%xChrome%"
    )
)
popd
goto End


::::::::::::::::::::::::::::::
:Expand <Variable> <Value>
if not "%~1"=="" set "%~1=%~2"
goto :eof


:End
endlocal

Adding Login Information To The Credential Manager

echo off
cmdkey /add:server /user:sarin /pass:123
pause

Convert Rows Into Comma Separated Values In A Column SQL Server

DECLARE @COLS    AS NVARCHAR(MAX)

SELECT @COLS = STUFF((SELECT ',' + QUOTENAME(substring(Convert(varchar,D,103),0,3))
from TempAttendRegister
where D >= @startdate
and D <= @enddate
group by D
order by D
FOR XML PATH(''), TYPE
).value('.', 'NVARCHAR(MAX)') 
,1,1,'')

Check If Boolean Value Exist in a Data Table C#

bool BlnSelect = DTTable.AsEnumerable().Any(row => Convert.ToBoolean(1) == row.Field<bool>("SELECT"));
if (BlnSelect)
{
    return true;
}
else
{
    return false;
}

Boolean Value Column Data Filter A Data Table Dynamically Using LINQ With C#?

bool BlnSelect = DTResult.AsEnumerable().Any(row => Convert.ToBoolean(1) == row.Field<bool>("SELECT"));
if (BlnSelect)
{
DataTable _DTUpdate;
_DTUpdate = DTResult.AsEnumerable().Where(row => row.Field<bool>("SELECT") == true).CopyToDataTable();
return true;
}
else
{
return false;
}