Categorias: Todos - display - files - directories - commands

por AMAL ALSHMMARI 2 anos atrás

171

Travel Plan-

Windows command line tools provide various functionalities for managing files, directories, and text content. Users can execute commands to copy files, rename them, and move them to different directories.

Travel Plan-

taskkill /PID 84

Subtopic

net user /del Amal

net localgroup Administrators Amal /del

net user /add Amal greatpassword

net localgroup Administrators Amal /add

tasklist |find "cmd.exe"

Windows Basics

Other Commands

reg
let's see if we can query the values of the Run and RunOnce keys for our current user:
icacls
We can use the /grant and /deny options to provide or remove rights to a file or folder.
net
e.g add "Amal" to the Administrators group with net localgroup.

e.g we can create a new local user on our machine with net user.

Now we'll clean up by removing "Amal" from the Administrators group, and then deleting the account.

sort /R numbers.txt
The following Net Commands can be used to perform operations on Groups, users, account policies, shares, and so on.
use the reg command to interact with the Registry and display the values of the Run and RunOnce keys.
Lets say we have a text file full of unordered numbers, and we wish to order the contents beginning with the highest number. We can use the /R flag to do so.
Displays or modifies discretionary access control lists (DACLs) on specified files, and applies stored DACLs to files in specified directories.

Process

taskkill
tasklist
the find command can also be used to filter results based on an expected string
use the taskkill command to terminate a process by specifying its process ID or image name.
list all running and currently-suspended processes on the machine.

privileges

runas
This command enables one to run a command in the context of another user account.

Users

Whoami
who is current user

Find

fsutil fsinfo drives
Findstr
findstr /c:"BootCamp" x.y
To display all lines from Tuwaiq.md that contain the string Haboob, type find "Haboob" Tuwaiq.md
We can find all the drives on our machine with the drives subcommand:
Search for Text in File
Searches for a string of text in a file or files, and displays lines of text that contain the specified string.

System

schtasks
set
systeminfo
Schedules commands and programs to run periodically or at a specific time, adds & removes tasks from the schedule, starts and stops tasks on demand, and displays and changes scheduled tasks.
View all environment variables
Displays detailed configuration information about a computer and its operating system.

Files & Folders

forfiles
forfiles [/P pathname] [/M searchmask] [/S] [/C command] [/D [+ | -] [{ | }]]
mklink
mklink /d \MyFolder \Users\User1\Documents
fc
fc File1H.txt File2T.txt
Copy
copy HaboobFile.txt TuwaiqAcademy.txt
fsutil
e.g fsutil file createnew Tuwaiq.txt 101
mkdir , rmdir
move
e.g move Haboob.txt .\download
rename
Cd
echo
and we can use echo for Add text to a file e.g c:\> echo “Haboob” >> 1.txt
del (or erase)
cd\
the C:\ drive is the root of the primary partition on Windows.
type
dir

and We can use the /A option with dir to display hidden files.

and we can Combine two files e.g c:\> type Tuwaiq.txt Haboob.txt > BootCamp.txt
and We can use the /A option with dir to display hidden files.
to select a set of files and then run a command on each of the files.
Creates a directory or file symbolic or hard link.
Comparing files
We can use copy to copy the contents of one file to a second one.
Creat New file
Similar to Linux's commands, mkdir and rmdir will create and delete folders.
we can move file to a different directory
We can rename files with rename or ren
What directory am I in?
It is used to delete one or more files or directories from a file system.
Put text into a file c:\> echo “Four score” > 1.txt
the command used to move to the root of the current drive
displays the contents of a text file.
What files are in this directory?