-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcmd.commands
More file actions
416 lines (263 loc) · 7.41 KB
/
cmd.commands
File metadata and controls
416 lines (263 loc) · 7.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<<<<<<<<<< COMMAND PROMPT (cmd) >>>>>>>>>>>>>
-------------------------------------------------
-------------------------------------------------
Keys:
batch file, check connections and ids, net help,
nginx cmds, cmds details, rem, if, for,
examples
-------------------------------------------------
-------------------------------------------------
-------------------------------------------------
>>>> Check Connections and ids <<<<<<<<
1. netstat -h //Helping
2. netstat -a //Display all active connections
-------------------------------------------------
-------------------------------------------------
Batch Files:
1. nginxstart.bat file //Batch file name
@echo off
D:
cd nginx
start nginx
ECHO D:\nginx
ECHO Web services successfully started
I:
cd console
.........................................
2. ntinxstop.bat //Batch file name
@echo off
D:
cd nginx
nginx -s stop
ECHO D:\nginx
ECHO Web services stopped successfully
cd/
I:
cd console
..........................................
3. nginxreload.bat //Batch file name
ECHO OFF
D:
cd nginx
nginx -s reload
cd/
i:
cd console
..........................................
4. nginxreopen.bat //Batch file name
@echo off
D:
cd nginx
nginx -s reopen
ECHO D:\nginx
ECHO Web services reopened successfully
cd/
I:
cd console
..........................................
5. phpcgistart.bat //Batch file name
..........................................
6. phpcgistop.bat //Batch file name
..........................................
7 mysqlstart.bat //Batch file name
..........................................
8 mysqlstop.bat //Batch file name
..........................................
9 Combine two or more batch files
webserver.bat //Batch file name
nginxstart.bat
mysqlstart.bat
phpstart.bat
-------------------------------------------------
-------------------------------------------------
>>> net help
net help
net user
net file
-------------------------------------------------
-------------------------------------------------
-------------------------------------------------
>>> nginx cmds <<<<<
nginx -s stop fast shutdown
nginx -s quit graceful shutdown
nginx -s reload changing configuration, starting new worker processes with a new
configuration, graceful shutdown of old worker processes
nginx -s reopen re-opening log files
-------------------------------------------------
-------------------------------------------------------------
>>>>> CMDS Details <<<<<<<<<<
Watch Files Examples:
1.
@echo off //Version Check
VER
2.
@echo off //Listing directories
DIR /a c:\example
3.
@echo off
DEL "My File.txt"
4.
@echo off
MKDIR C:\Users\StackHowTo\MyFolder
5.
@echo off
RMDIR C:\Users\StackHowTo\MyFolder
6.
@echo off
RENAME example.txt test.txt
7.
@echo off
REPLACE "C:\tmp\record.mp3" C:\records /s
8.
@echo off
MOVE oldfile.txt newfile.doc
9.
@echo off
COPY source.doc newfile.doc
10.
@echo off
CD ..
11.
@echo off
CHDIR ..
12.
@echo off
CHKDSK C:
13.
@echo off
CLS
14.
@echo off //Change the color or background of console
COLOR 17
15.
@echo off //Compare
COMP C:\demo\file1.txt C:\demo\file2.txt
16.
@echo off //System date
echo %DATE%
echo %TIME%
16.
@echo off //display the department variable
Set _department = 'Tech'
ECHO %_department%
17.
//If conditions
@echo off
IF EXIST "filename" (
echo 'File EXIST!'
) ELSE (
echo 'File missing!'
)
18.
@Echo Off //exit if the required file “myFile.txt” is missing
IF NOT EXIST myFile.txt EXIT /b
Echo "File Exists!"
19.
@Echo Off //For Loop
FOR /L %%A IN (1,1,10) DO (
ECHO %%A
)
29. //IF
@Echo Off
IF NOT EXIST myFile.txt EXIT /b
Echo "File Exists!"
21. //REM
@Echo Off //All commands coming after REM or :: are considered
:: First comment //as comments by the console
REM Second comment
22.
@Echo Off //GOTO
GOTO next_message
Echo "This will not display"
goto:eof
:next_message
Echo "Next Message"
23. //PAUSE
@Echo Off
PAUSE
24. //CALL
@Echo Off //This command allows you to call
CALL SecondScript //a batch file from another batch file
25.
//This command allows you to read and
// delete variables in the command prompt.
@echo off
Set /P _department=Please enter Department:
If /i "%_department%"=="finance" goto finance
If /i "%_department%"=="hr" goto hr
goto:eof
:finance
echo You have chosen the Finance department
goto:eof
:hr
echo You have chosen the HR department
goto:eof
26. //Title
@Echo Off
TITLE "Welcome to StackHowTo!"
27. //START
@Echo Off //This command allows you to start
START notepad.exe //some programs or some commands
START calc.exe
28.
SHUTDOWN //SHUTDOWN
@Echo Off //To closes the session
SHUTDOWN /s /t 60 /c
29.
//FIND
@Echo Off
FIND "hello" myFile.txt
30.
//MORE
@Echo Off
FIND "hello" myFile.txt
31.
//TYPE
@Echo Off //This command allows you to display the contents of text files
TYPE myFile.txt
32.
@Echo Off //PING
PING -n 5 www.example.com
33. //HOSTNAME
@Echo Off
HOSTNAME
---------> End OF Commnds <-------------------------
-----------------------------------------------------
-----------------------------------------------------
>>>> Batch File Examples <<<<<<<
1.
@ECHO OFF
ECHO Hello World! Your first batch file was printed on the screen successfully.
PAUSE
2.
@ECHO OFF
:: This batch file details Windows 10, hardware, and networking configuration.
TITLE My System Info
ECHO Please wait... Checking system information.
:: Section 1: Windows 10 information
ECHO ==========================
ECHO WINDOWS INFO
ECHO ============================
systeminfo | findstr /c:"OS Name"
systeminfo | findstr /c:"OS Version"
systeminfo | findstr /c:"System Type"
:: Section 2: Hardware information.
ECHO ============================
ECHO HARDWARE INFO
ECHO ============================
systeminfo | findstr /c:"Total Physical Memory"
wmic cpu get name
wmic diskdrive get name,model,size
wmic path win32_videocontroller get name
wmic path win32_VideoController get CurrentHorizontalResolution,CurrentVerticalResolution
:: Section 3: Networking information.
ECHO ============================
ECHO NETWORK INFO
ECHO ============================
ipconfig | findstr IPv4ipconfig | findstr IPv6
START https://support.microsoft.com/en-us/windows/windows-10-system-requirements-6d4e9a79-66bf-7950-467c-795cf0386715
PAUSE
3.
-----------------------------------------------------
-----------------------------------------------------
-----------------------------------------------------