1. Lệnh Ping : Cú pháp: Code: ping ip/host [/t][/a][/l][/n]



tải về 1.67 Mb.
Chế độ xem pdf
trang85/92
Chuyển đổi dữ liệu18.05.2022
Kích1.67 Mb.
#52014
1   ...   81   82   83   84   85   86   87   88   ...   92
Cac lenh co ban trong DOS

Alternative 
A delay can also be produced by the 
PING
 command with a loopback address (127.0.0.1), in 
tests this consumes less processor time than Sleep.exe or Timeout.exe: 


e.g. for a delay of 30 seconds: 
PING -n 31 127.0.0.1>nul
See 
Clay Calvert's
 newsgroup posting for a full explanation of this technique. 
“I think men talk to women so they can sleep with them and women sleep with men so they can 
talk to them” ~ Jay McInerney
SOON.exe
 (
Resource Kit

Schedule a command to run in the near future (calls the AT command) 
Syntax 
SOON [\\computernamedelay [/interactive] "command
SOON /i:[on|off] 
Key 
delay : When the command should run, in SECONDS from now. 
default=5 
/interactive : Allows any user to see the job as it runs, 
this allows testing and monitoring of the 
command. 
You can specify /interactive as just /i 
computername : the UNC name of a remote machine 
/i:on : Make /interactive the default behaviour 
use SOON /i:off to restore normal behaviour 
SOON schedules jobs to run at a time relative to the current time in "seconds from now" 
It is otherwise identical to the AT command but saves calculating an exact start time. 
As with all 
AT
 jobs you should test your SOON scripts by using the /INTERACTIVE option. 
In many cases 
SCHTASKS
 may be a better option. 
"We want the finest wines available to humanity. And we want them here and we want them 
now" ~ Bruce Robinson (Withnail and I ) 
START
 
Start a program, command or batch script (opens in a new window.) 
Syntax 
START "title" [/Dpath] [options] "command" [parameters
Key: 
title : Text for the CMD window title bar (required) 
path : Starting directory 
command : The command, batch file or executable program to run 
parameters : The parameters passed to the command 
Options: 
/MIN : Minimized 
/MAX : Maximized 
/WAIT : Start application and wait for it to terminate 
/LOW : Use IDLE priority class 


/NORMAL : Use NORMAL priority class 
/HIGH : Use HIGH priority class 
/REALTIME : Use REALTIME priority class 
/B : Start application without creating a new window. In 
this case 
^C will be ignored - leaving ^Break as the only way to
interrupt the application 
/I : Ignore any changes to the current environment. 
Options for 16-bit WINDOWS programs only 
/SEPARATE Start in separate memory space (more robust) 
/SHARED Start in shared memory space (default) 
Always include a 
TITLE
this can be a simple string like "My Script" or just a pair of empty quotes 
"" 
According to the Microsoft documentation, the 
title
is optional, but you may will have problems if 
it is omitted. 
Document files may be invoked through their file association just by typing the name of the file 
as a command.
e.g. 
START "" MarchReport.DOC
will launch the application associated with the .DOC file 
extension and load the document. 
Examples 
Run a minimised Login script: 
START "My Login Script" /Min Login.cmd
Start a program and wait for it to complete before continuing: 
START "" /wait autocad.exe
Open a file with a particular program

START "" "C:\Program Files\Microsoft Office\Winword.exe" 
"D:\Docs\demo.txt"
Open Windows Explorer and list the files in the current folder (.) : 
C:\any\old\directory> START .
Connect to a new printer: (this will setup the print connection/driver ) 
START \\print_server\printer_name
Start an application and specify where files will be saved (Working Directory): 
START /Dc:\Documents\ /MAX "Maximised Notes" notepad.exe 
Run several Programs in Sequence 
To run a sequence of 32 bit GUI programs to complete a task, create a batch file that uses start 
/wait: 
@echo off 
start /wait /b First.exe 
start /wait /b Second.exe 
start /wait /b Third.exe
This is similar to the way batch files would run under MSDOS command.com (16 bit) 
It is best to specify the full path to the application including file extension. If you START an 
application without a file extension (for example 
WinWord
instead of 
WinWord.exe)
then the 
PATHEXT environment variable will be read to determine which file extensions to search for and 
in what order. The default value for the PATHEXT variable is:
.COM;.EXE;.BAT;.CMD


The syntax for PATHEXT is the same as %PATH%, with semicolons separating each item. 
If there is no match on any extension, then START will look to see if the name, matches a 
directory name and if so will launch Explorer on that path. 
START is an 
internal
 command. If 
Command Extensions
 are disabled, the START command will 
no longer recognise file Associations, and will not automatically evaluate the COMSPEC 
variable when starting a second CMD session. 
“Do not run; scorn running with thy heels” ~ Shakespeare, The Merchant of Venice
SU
 (
Resource Kit

Switch User. 
Syntax 
SU "[cmdline]" [domain] [[Winsta\]Desktop] [options
Key 
cmdline The command to run (default =%comspec%) 
domain The domain for the user account ('.' = local m/c) 
Winsta\Desktop The profile to load (default = current) 
Options 
-cb console bypass 
-dn do not switch to new desktop 
-g GUI option 
-l load the .Default user registry hive 
-w use current registry hive
-e Inherit parent environment 
-b batch logon
-i interactive logon
-s service logon 
-n network logon 
-v verbose 
All LogOn Types require specific 
User Rights
 to be granted... 
SeNetworkLogonRight, SeServiceLogonRight, SeInteractiveLogonRight, SeBatchLogonRight 
The 
RUNAS
 command is a lot easier to use! 
“He who reigns within himself, and rules passions, desires, and fears, is more than a king” ~ 
Milton 
SYSTEMINFO
 
List system configuration 
Syntax 
SYSTEMINFO [/S system [/U username [/P [password]]] ] 
[/FO format] [/NH] 
Key: 
/S system Remote system to connect to. 
/U [domain\]user User context under which to execute. 
/P [password] Password for the given user (will prompt if 
omitted) 
/FO format Output format: TABLE, LIST or CSV 


/NH No "Column Header" in the Table/CSV output 
The output includes OS configuration, security info, product ID, RAM, disk space, and network 
cards. 
Examples 
SYSTEMINFO
SYSTEMINFO |find "Total Physical Memory:" 
SYSTEMINFO /S wkstn6324
SYSTEMINFO /S wkstn6325 /FO CSV /NH >>pcaudit.csv
“A good question is like a miniskirt. Long enough to cover the essentials, but short enough to 
keep everyone interested” ~ Charles Halsey 
TASKLIST
 
TaskList displays all running applications and 
services
 with their Process ID (PID) This can be 
run on either a local or a remote computer. 
Syntax 
tasklist options 
Options: 
/s computer Name or IP address of a remote computer 
Don’t use backslashes. Default = local computer. 
/u domain\user [/p password]] 
Run under a different account 
/svc List information for each process without truncation. 
Valid when /fo=TABLE. Cannot be used with /m or /v 
/m [ModuleName
Show the processes that include the given module. 
/v Verbose task information 
/fo {TABLE|LIST|CSV}] 
Output format, the default is TABLE. 
/nh No Headers in the output (does not apply to LIST 
output) 
/fi FilterName [/fi FilterName2 [ ... ]] 
Apply one of the Filters below: 
Imagename eq, ne String 
PID eq, ne, gt, lt, ge, le Positive 
integer. 
Session eq, ne, gt, lt, ge, le Any valid 
session number. 
SessionName eq, ne String 
Status eq, ne RUNNING | NOT 
RESPONDING 
CPUTime eq, ne, gt, lt, ge, le Time hh:mm:ss 
MemUsage eq, ne, gt, lt, ge, le Any valid 
integer. 
Username eq, ne User name 
([Domain\]User). 
Services eq, ne String 
Windowtitle eq, ne String 


Modules eq, ne String 

tải về 1.67 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   81   82   83   84   85   86   87   88   ...   92




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương