May 3, 2024 | cmd, command, windows command
الأمر الرئيسي في نظام التشغيل Windows هو Command Prompt أو CMD. يعتبر Command Prompt واحدًا من الأدوات الأساسية في نظام التشغيل Windows، حيث يسمح للمستخدمين بالتفاعل مع النظام عبر سطر الأوامر.
يقدم Command Prompt مجموعة واسعة من الأوامر التي تتيح للمستخدمين القيام بمختلف المهام، سواء كان ذلك إدارة الملفات والمجلدات، أو تنفيذ البرامج، أو إجراء عمليات الشبكة، وأكثر من ذلك بكثير.
من بين الأوامر الرئيسية التي يمكن استخدامها في CMD:
- dir: لعرض قائمة بجميع الملفات والمجلدات في المجلد الحالي.
- cd: لتغيير المجلد الحالي.
- mkdir: لإنشاء مجلد جديد.
- del: لحذف ملف محدد.
- copy: لنسخ ملف من موقع إلى آخر.
- مثال:
copy file1.txt C:\Backup
- ipconfig: لعرض معلومات حول تكوين الشبكة.
- ping: لاختبار الاتصال بجهاز أو موقع على الشبكة.
- مثال:
ping www.google.com
- tasklist: لعرض قائمة بالعمليات التي تعمل حاليًا على النظام.
- shutdown: لإيقاف تشغيل أو إعادة تشغيل الكمبيوتر.
- rename: لإعادة تسمية ملف محدد.
- مثال:
rename oldfile.txt newfile.txt
- cls: لمسح شاشة Command Prompt.
- echo: لعرض رسالة نصية على الشاشة أو توجيه النص إلى ملف معين
.
- find: للبحث عن نص معين داخل ملف معين.
- مثال:
find "example" file.txt
- attrib: لعرض أو تغيير سمات الملفات والمجلدات.
- tree: لعرض هيكل مجلدات المجلد الحالي والمجلدات الفرعية.
- help: لعرض قائمة بالأوامر المتاحة في Command Prompt مع شرح موجز لكل أمر.
هذه مجرد بعض الأمثلة عن الأوامر الأساسية التي يمكن استخدامها في Command Prompt. تتوفر أيضًا العديد من الأوامر الأخرى التي يمكن استخدامها لأغراض مختلفة، ويمكن للمستخدمين استكشافها واستخدامها وفقًا لاحتياجاتهم الخاصة.
هذه الأوامر تسهل إدارة النظام وتنفيذ المهام المختلفة على نظام التشغيل Windows. يمكنك استكشاف واستخدام هذه الأوامر وفقًا لاحتياجاتك الخاصة.
يعتبر Command Prompt أداة قوية ومفيدة لإدارة النظام وتنفيذ العديد من المهام، ويمكن للمستخدمين الاستفادة الكاملة منها من خلال فهم واستخدام الأوامر المختلفة المتاحة فيه.
May 2, 2016 | cmd, Learn and Teach, net command, net user, user accounts, windows
source: http://www.windows-commandline.com/cmd-net-user-command/
Net user command : Manage user accounts from command line
Using Net user command, administrators can manage user accounts from windows command prompt. Below are some examples on how to use this command.
Add a domain user account:
Net user /add newuseLoginid newuserPassword /domain
Add new user on local computer:
Net user /add newuserLoginid newuserPassword
Advanced options to add new user account can be read in the below article.
Add new user from windows command line.
Disable/Lock a domain user account:
Net user loginid /ACTIVE:NO /domain
To enable/unlock a domain user account:
Net user loginid /ACTIVE:YES /domain
Prevent users from changing their account password:
Net user loginid /Passwordchg:No
To allow users to change their password:
Net user loginid /Passwordchg:Yes
To retrieve the settings of a user:
Net user username
Example:
C:>net user techblogger
User name techblogger
Full Name
Comment
User's comment
Country code 000 (System Default)
Account active Yes
Account expires Never
Password last set 4/21/2011 10:10 PM
Password expires 8/19/2011 10:10 PM
Password changeable 4/21/2011 10:10 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon Never
Logon hours allowed All
Local Group Memberships *Users
Global Group memberships *None
The command completed successfully.
Feb 23, 2016 | cmd, glossary, Learn and Teach, windows, windows command
Her I am going to report all windows command that I have been used to make easy for me and visitors who would like to return to it at anytime and wherever.
All Windows command will be below I will try to sort it alphabetically:
A
B
C
D
Listing the files
Listing all files and directories in the Directory that you are in
Listing all files and sub-directories files
Dir syntax
Microsoft Windows 2000, XP, Vista, 7, and 8 syntax
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N] [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]
[drive:][path][filename] |
Specifies drive, directory, or files to list. |
/A |
Displays files with specified attributes. |
attributes |
D- Directories R- Read-only files H- Hidden files A- Files ready for archiving S- System files I- Not content indexed files L- Reparse Points – Prefix meaning not |
/B |
Uses bare format (no heading information or summary). |
/C |
Display the thousand separator in file sizes. This is the default. Use /-C to disable display of separator. |
/D |
Same as wide but files are list sorted by column. |
/L |
Uses lowercase. |
/N |
New long list format where filenames are on the far right. |
/O |
List by files in sorted order. |
sortorder |
N By name (alphabetic) S By size (smallest first) E By extension (alphabetic) D By date/time (oldest first) G Group directories first – Prefix to reverse order |
/P |
Pauses after each screenful of information. |
/Q |
Display the owner of the file. |
/R |
Display alternate data streams of the file. |
/S |
Displays files in specified directory and all subdirectories. |
/T |
Control what time field displayed or used for sorting |
timefield |
C Creation A Last Access W Last Written |
/W |
Uses wide list format. |
/X |
This displays the short names generated for non-8dot3 file names. The format is that of /N with the short name inserted before the long name. If no short name is present, blanks are displayed in its place. |
/4 |
Displays four-digit years |
Microsoft Windows 95, 98, and ME syntax
Displays a list of files and subdirectories in a directory.
DIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]] [/O[[:]sortorder]] [/S] [/B] [/L] [/V]
[drive:][path][filename] |
Specifies drive, directory, or files to list. (Could be enhanced file specification ormultiple filespecs.) |
/P |
Pauses after each screenful of information. |
/W |
Uses wide list format. |
/A |
attributes: D Directories R Read-only files H Hidden files A Files ready for archiving S System files – Prefix meaning not |
/O |
List by files in sorted order, sortorder: N By name (alphabetic) S By size (smallest first) E By extension (alphabetic) D By date and time (earliest first) G Group directories first – Prefix to reverse order A By Last Access Date (earliest first) |
/S |
Displays files in specified directory and all subdirectories. |
/B |
Uses bare format (no heading information or summary). |
/L |
Uses lowercase. |
/V |
Verbose mode. |
Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with – (hyphen)–for example, /-W.
Dir examples
dir
Lists all files and directories in the current directory. By default the dir command lists the files and directories in alphabetic order.
dir *.exe
The above command lists any file that ends with the .exe file extension. See the wildcarddefinition for further wildcard examples.
dir *.txt *.doc
The above is using multiple filespecs to list any files ending with .txt and .doc in one command.
dir /ad
List only the directories in the current directory. If you need to move into one of the directories listed use the cd command.
dir /s
Lists the files in the directory that you are in and all sub directories after that directory, if you are at root “C:>” and type this command this will list to you every file and directory on the C: drive of the computer.
dir /p
If the directory has lots of files and you cannot read all the files as they scroll by, you can use this command and it displays all files one page at a time.
dir /w
If you don’t need file information you can use this command to list only the files and directories going horizontally, taking as little as space needed.
dir /s /w /p
This would list all the files and directories in the current directory and the sub directories after that, in wide format and one page at a time.
dir /on
List the files in alphabetical order by the names of the files.
dir /o-n
List the files in reverse alphabetical order by the names of the files.
dir /s |find “i” |more
A nice command to list all directories on the hard drive, one screen page at a time, and see the number of files in each directory and the amount of space each occupies.
dir > myfile.txt
Takes the output of dir and re-routes it to the file myfile.txt instead of outputting it to the screen.
E
F
G
H
I
J
K
L
M
N
NBTSTAT -A IPADDRS
Used for:
- Finding computer name using IP
O
P
Q
R
S
T
U
V
W
X
Y
Z
Nov 12, 2015 | Alias, Alias command, Aside, cmd, Mac, osx command, osx terminal, terminal
Alias
alias
Create an alias. Aliases allow a string to be substituted for a word. An alias can be used as the first word of any simple command.
Syntax
alias [-p] [name[=value] ...]
unalias [-a] [name...]
Key
-p Print the current values
-a Remove All aliases
When arguments are supplied, an alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias
substitution when the alias is expanded.
If no value is given, (or with the -p option) alias will print a list of Aliases along with their current values. For each name in the argument list for which no value is supplied, the name and value of the alias is printed.
Alias returns true unless a name is given for which no alias has been defined.
name can not be `alias’ or `unalias’.
unalias can be used to remove each name from the list of defined aliases.
Alias substitution
The shell maintains a list of aliases which can be set, unset and printed by the alias and unalias commands. After a command line is parsed into simple commands the first word of each command, left-to-right, is checked to see if it has an alias. If so, the first word is replaced by the alias. If the alias contains a history reference, it undergoes History substitution (q.v.) as though the original command were the previous input line. If the alias does not contain a history reference, the argument list is left untouched.
Thus if the alias for ls were ls -l the command ls /usr would become ls -l /usr, the argument list here being undisturbed. If the alias for lookup were grep !^ /etc/passwd‘ then lookup bill would become grep bill /etc/passwd.
Aliases can be used to introduce parser metasyntax. For example, alias print ‘pr !* | lpr’ defines a command (print) which pr‘s its arguments to the line printer.
The first word of the replacement text is tested for aliases, but a word that is identical to an alias being expanded is not expanded a second
time. This means that you can alias ls to ls -F, for instance, and bash does not try to recursively expand the replacement text.
Examples
Create an alias ‘c’ that will clear the screen:
$ alias c=’clear’
Create an alias ‘ls’ that will change the default action of ls:
$ alias ls=’ls –classify’
$ ls
$ unalias ls
More aliases for ls:
$ alias la=’ls -lAXh –color=always’ #Show all, sort by extension
$ alias ls-al=’ls -al’ #fix typo missing space
$ alias l=”ls -l”
$ alias la=”ls -la”
Use alias to fix missing space typos:
$ alias cd..=’cd ..’
$ alias ..=’cd ..’
Display the working directory
$ alias .=’echo $PWD’
Prevent accidental deletions by making rm interactive:
$ alias rm=’rm -i’
Shorten apt-get installation commands:
$ alias canhaz=’sudo apt-get install’
Run firefox and open a specific website:
$ alias fftr=’/Applications/Firefox.app/Contents/MacOS/firefox-bin http://ss64.com’
Produce a custom prompt to display which machine you are on, the current folder, and the number of the current command:
$ alias cd='cd !*; set currDir = `basename $cwd`; set currDir = `echo
"<${host}:"$currDir
" ! >"`; set prompt = "${currDir} "'
$ cd $cwd
<Mac_One:Work-folder 15 >
Making an alias permanent:
Assuming you have the BASH shell, then use your favorite text editor to edit or create a file called ~/.bash_aliases and add your alias commands.
alias is a bash built-in command.
“There are many reasons why novelists write, but they all have one thing in common – a need to create an alternative world” ~ John Fowles
Related:
Alias man page – Apple.com
env – Display, set, or remove environment variables
echo – Display message on screen
set – Set a shell variable
shift – Shift positional parameters
Nov 12, 2015 | cmd, format, Gallery, Learn and Teach, reformat disk, terminal, windows
How to Diskpart Erase or Clean a Drive
source
Critical Instructions:
- Disclaimer: Seagate Technology, LLC is not responsible for lost user data. Be sure to back up any important data on this drive before proceeding.
- This article explains the Microsoft Diskpart Erase utility. The command that erases the drive during this process is “Clean”. In this article “Clean” and erase are used interchangeably. Cleaning or erasing a storage device removes all data and partitions from the drive.
- Please read all steps, instructions, and warnings before attempting the Diskpart Erase/Clean.
- Diskpart Erase/Clean will permanently erase/destroy all data on the selected drive. Please make certain that you are erasing the correct disk.
- Remove all additional drives from the computer excluding the drive you are booting from and the drive you want to Erase/Clean.
- For more information regarding Microsoft’s Diskpart Utility please select here: http://technet.microsoft.com/en-us/library/bb490893.aspx
Items to note:
- This article will walk through the steps of using the Microsoft Diskpart Erase utility to Clean the disk of a previous partition and format, including any data on the drive. This command takes only a few minutes to complete.
- This article covers Diskpart Erasing a 3TB or larger drive that has a Master Boot Record (MBR) Partition table, which is thereby limiting its capacity to 2TB. However, this article also applies to any scenario where a Diskpart Erase of an entire disk is necessary.
- For more information regarding drives over 2TB and GPT/MBR partition tables please see the following articles.
- To determine the disk number assigned to the 3TB+ MBR partitioned drive follow the steps below.
- From the Start menu right click on Computer which will provide a drop down menu. (If you are on Windows 8 or 8.1 move your mouse to the bottom left hand corner of the desktop screen and right click. Then select Disk Management).
- Choose Manage.
- Select Disk Management (listed under Storage).
- Look for the drive that is identified as the 3TB drive (2794GB). The properties window shows that the partition table on the drive is MBR . Important: note the Disk number (such as Disk 1).
- Open a Command Prompt window. To open the Command Prompt on a Windows Vista or Windows 7 machine click on Start and type cmd in the search bar. Then right click on cmd.exe and run as administrator. It will prompt you with the message, “Do you want to allow the following program to make changes to this computer,” click yes. A black Command Prompt window will open.
On Windows 8 move your mouse to the bottom left hand corner of the desktop screen and right click. Select Command Prompt (Admin) from the pop-up menu.
This is the Command Prompt window.
- From the command prompt, type diskpart and press Enter.
The diskpart prompt will open.
- From the diskpart prompt, type list disk and press Enter.
A list of disks will appear in a text format. You will return to the diskpart prompt. Step one verified that Disk 1 is the 3TB drive.Warning: Diskpart Erase/Clean will permanently erase/destroy all data on the selected drive. Please be certain that you are erasing the correct disk.
- From the diskpart prompt you will need to select a disk disk number (for instance, if the 3TB+ drive is Disk 1, you would typeselect disk 1) and press Enter. Warning: Diskpart Erase/Clean will permanently erase/destroy all data on the selected drive. Please be certain that you are erasing the correct disk.
A message appears saying that the disk is selected. You will return to the diskpart prompt. Warning: Diskpart Erase/Clean will permanently erase/destroy all data on the selected drive. Please be certain that you are erasing the correct disk.
- From the diskpart prompt, type clean and press Enter. The drive’s partition, data, and signature is now removed. You will return to the diskpart prompt. Warning: Once you type clean and hit enter the drive will be erased. No warning will be provided.
- The Command Prompt window will display the message “DiskPart succeeded in cleaning the disk“. Close out of the Command Prompt window by clicking the red X in the upper right hand corner.
Now the 3TB+ drive can be re-initialized, partitioned, and formatted.
- Reference How to use Add a New Disk/Reformat in Windows using DiscWizard v16 to Initialize the drive in GPT and format the drive for use.
How to Diskpart Erase or Clean a Drive
Nov 12, 2015 | cmd, format, Image, Learn and Teach, reformat disk, windows, مشكلة في الفلاش
Format a hard drive with Command Prompt
source
In Windows I would normally be driven to either format a drive through the Disk Management console or by right-clicking on a drive in Windows Explorer and selecting the “Format…” option, but there can be advantages to formatting a driver through Command Prompt. For example if you are reformatting a drive which previously had an Operating System on the drive you can find there are System Partitions on the drive which can’t be seen in Windows Explorer and refuse to format in the Disk Management console.
Note this is only a quick guide for Formatting Drives from Command Line, there are many more options available at your disposal. For a detailed insight to the options available for the DiskPart tool visit Microsofts Technet. In the example I have formatted an external hard drive for use of file storage in a Windows Operating System environment.
In order to format a drive through Command Prompt firstly lets open the prompt.
Click Start > Run and type “CMD”, pressing Enter should open a new terminal.
We need to next start the Disk Part tool, type “DISK PART” into the Command Line and press Enter.
Next let’s display and identify which volume we would like to format. Type “list volume” and press Enter. You should see a list of available volumes. Identify the one which you wish to format, be careful selecting the wrong volume will spell disaster!
Type “select volume <x>” and press Enter, where <x> is the volume you wish to focus on.
Type “clean” and press Enter. This removes any and all partition or volume formatting from the disk in focus.
Type “create partition primary” and press Enter. This creates a primary partition on the current disk. After you create the partition, the focus automatically shifts to the new partition. It is possible to create multiple partitions if you like. To do this you would add the option size=<x> where <x> is the size in megabytes (MB) you would like the partition to be. If no size is specified, like in my example, the partition continues until there is no more unallocated space.
Type “format fs=ntfs quick label=test” and press Enter. This will now perform a quick format, using a ntfs file system and labelling the drive “test”. You may wish to use the file system fat32 in place of ntfs if you would like to use the drive with other operating systems.
Lastly type “assign letter <x>” and press Enter, where <x> is the letter you would like to assign the drive.
You can close the Disk Part tool and Command Prompt using the “exit” command. You should now see your freshly formatted drive in My Computer, ready to use.
Format a hard drive with Command Prompt