8/1/16

Command Line Tricks

Command Line is a very powerful program with lots of tricks that not only controls what you see on your computer but can make life easier if you remember these key tricks.

System File Check - great trick to fix hard drive booting problems and repair your Windows OS when things just don't see to work right.

type "sfc /scannow
now if you get an error that it was protected then do this below
             type "findstr /c:"{SR}"%windir%\Logs\CBS\CBS.log>"%userprofile%\Desktop|sfcdetails.txt"

Now identify the corrupt file and source and goto another computer running the same version of Windows and issue the following command for each corrupt file, replacing with the files path ex: c:\Windows\System32\ and with it's filename (jscript.dll)
                       
                          takedown /f \
                            icarrs\/
                         GRANT ADMINISTRATOR:F

and copy the file you took from another computer into the same folder
                         copy\
                        \

now run SFC again and the corrupt file that you replace should be gone

Robocopy - difficult setup, but once it's done it makes your life easy copying multiple files and folders on the go

Type in dir in command prompt and to show hidden folders type the following
                        dir /A:H = shows attributes and hidden files 
what to know what other commands you can use type dir/? or help dir on the command line and it will show you other command options. 

Tree = command shows subfolders
cd = change to different director or move files to a new folder, cd is a way of moving to a folder in another folder. 
md = make directory or create a new folder
rmdir = delete a directory 
del or del *.* = delete file and when you add *.* it means delete all files in that folder
verify on and off = confirm files that you copied
/no copy = removes all file information
/b = allows administrators to copy files that they usually would be denied access too
format = to format a drive
format /q = quickly format the drive
format options ad /FS, V: = specify file system Fat, Fat32, exFat, NTFS volume to be formatted
fsutil = list of commands that are supported
convert from FAT32 to NTFS type convert /fs:ntfs
ckdsk = check window at boot time
ipconfig /renew6 = resets IPv6 addresses
ipconfig /flushdns = clear domain names over the internet
ipconfig /renew = renew ip address of computer
ipconfig/release = release ip address of computer
tracert = if internet is sluggish instead of ping type tracert to route you and your target for connection times
netstat = run in admin to find out more about a program process ex; netstat -b
driverquery = includes info on drivers on your pc
-v = more information on the file system ex: drivequery -v>drivers.txt
powercfg = information on power options ex: powercfg /a
powercfg /h = disable or enable hibernation in power mode
powercfg /enegery = gives energy report of efficiency and battery
powercfg /batteryreport = gives you a battery health report
diskpart = very dangerous and make sure to make an image backup, it will erase your hard drive
diskpart cmds = type help but becareful anything you do here may destroy all of your hard drive data
echo off command = prevents command from batch file from showing up in command line
cls = clears screen