Create file folder:
md "E:\My documents\Newfolder1"
Search specific file:
dir d:\ e:\ /s /b | find "x.x"
Create an empty file:
cd. > a.txt
cd. Indicates that the current directory is changed to the current directory, that is, it is not changed; And this command has no output
> Indicates that the command output is written to a file. Followed by a.txt, it means to write to a.txt.
In this case, the command will not have output, so an empty file with no content is created.
copy nul a.txt
Nul represents an empty device. Conceptually, it is invisible and exists in each directory. It can be regarded as a special "file" with no content; Generally, the output can be written to nul to mask the output. For example, pause > nul, the execution effect of this command is to pause, and "please press any key to continue..." will not be displayed.
This example shows that an empty device is copied to a.txt, and an empty file without content is also created.
type nul > 1.txt
This example shows that the contents of an empty device are displayed and written to a.txt
fsutil file createnew a2.txt 1
An empty file was created using fsutil.
echo a 2 > a.txt
"2" indicates the handle of error output. In this case, there is no error output, so an empty file without content is created.
In fact, the default is to redirect handle 1, that is, the standard output handle. For example, CD. > a.txt is actually CD. 1 > a.txt.
Similarly, handles 3 to 9 can also be used. In this case, they are undefined handles and will not have output, such as echo a 3>a.txt
Create a non-empty file
echo a > a.txt
The most commonly used command is echo. This example means that the letter A and carriage return line feed are overwritten and output to a.txt (if the original content of a.txt is overwritten), if you add content, you can use >>. For example, echo b >> a.txt means that B and carriage return line feed are appended to the end of the file.
View file:
type "ApplicationDB\Stored Procedures\Rpt_CfgAttrSp.sp"
Append data to existed file:
COPY filename+CON
TYPE CON>>filename
After input press key F6 or Ctrl+Z
Delete file:
rd /s /q %windir%\temp & md %windir%\temp
del /f /s /q %systemdrive%\*.tmp
Delete file whose name contains space:
for /r "C:\Test" %v in (*.txt) do del "%v"
Copy files:
copy d:\test.txt+d:\abc.txt d:\test\test.txt
type a.txt > b.txt
copy a.txt b.txt
fsutil file createnew d:\a.txt 1
Copy from another computer:
xcopy \\cnshdbqin1\resource D:\res /s /c
Copy from another computer with user and password:
net use \\10.86.26.167\fs1 P@ssword123 /user:shareuser
xcopy \\10.86.26.167\fs1\grampian.csv D:\res /s /c
net use \\10.86.26.167\fs1 /delete
Multi-threaded file copy:
robocopy d:\work e:\back /s /j /xf *.tmp *.bak
Open the program:
start d:\TheWorld\TheWorld.EXE "e:\My documents\I_have_a_page.htm"
Open website:
@echo off
path=%path%; C:\Program Files\Internet Explorer\iexplore.exe
start iexplore http://cnshvwmg902ap01/WSWebClient/WSWebForm.aspx
Open folder:
@echo off
start "" "\\cnshwfps2\Departments\R&D"
Receive the value from command line:
set /p a=
echo Your input is: %a%
Check local port:
netstat -aon | find "80"
tasklist | findstr "3096"
Search local string:
findstr /S /N "Option" C:\vss_root\ \(-name \*.txt -o -name \*.vb -o -name \*.sql \)
Change password of :
Remote Computer: Ctrl+Alt+End
Local Computer: Ctrl+Alt+Del
Remote desktop connect command:
mstsc /v: USCOVWCS10DB /console
Minmun all windows except current:
win+Home
Shift window between different screens:
Press key WIN+SHIFT+LEFT | RIGHT
Run a program as an administrator
Press key CTRL+SHIFT and Click the exe file
Close the process of remote computer:
tasklist /S cnshdbqin2 /U infor\bqin /P Winter_01
|FIND /i "taskmgr" && (echo OK || echo error) && taskkill /S cnshdbqin2 /U info
r\bqin /P Winter_01 /im taskmgr.exe
Wait for some time:
ping 1.1.1.1 -n 1 -w 30000
timeout /t 10
Show the control set:
rundll32.exe shell32.dll,Control_RunDLL
Fix IE:
regsvr32 Shdocvw.dll
regsvr32 Oleaut32.dll
regsvr32 Actxprxy.dll
regsvr32 Mshtml.dll
regsvr32 Urlmon.dll
regsvr32 browseui.dll
regsvr32 Oleaut32.dll
regsvr32 Actxprxy.dll
regsvr32 Mshtml.dll
regsvr32 Urlmon.dll
regsvr32 browseui.dll
No comments:
Post a Comment