Some useful windows commands
How do I run two commands in one line in Windows CMD?
<cmd1> & <cmd2>
If you want the second command to execute only if the first exited successfully:
<cmd1> && <cmd2>
setx <env_var_name> <env_var_value>
REM this is comment
:: this is another comment
Windows equivalent of whereis?
where powershell
# C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
tree /f
use /f to show files
“rm -rf” equivalent for Windows?
rd -r -force "path" # -r for recursive
4 Ways To Find Large Files In Windows 10
Find all files larger than 1GB and write their paths to the file "/path/to/largefiles.txt".
forfiles /S /M * /C “cmd /c if @fsize GEQ 1073741824 echo @path > "/path/to/largefiles.txt"
How to Merge Text (.Txt) Files in Command Prompt
copy *.txt "merged.txt"
Can Windows' copy command handle multiple files?
for %%I in ("C:\dirA\*.dll" "C:\dirB\*.dll") do copy /Y %%I "C:\targetDir\"
Copy recursively:
xcopy directories and subdirectories recursively and filter only filenames by extension
xcopy "C:\source\dirA*" "dirA\" /sy
mklink /d <link_name> <target>
net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK \\abc\def Microsoft Windows Network
The command completed successfully.
ipconfig /displaydns
Server network cannot access with name but accessible with ip
ipconfig /flushdns
Find the IP address of a Mapped Network drive in Windows
After finding the computer name as "abc" using net use
:
ping abc -4
Browse an UNC path using Windows CMD without mapping it to a network drive
pushd "\\network_host\a\network\path"
:: go back
popd
Disconnecting / logging out from Windows network share without restarting Workstation service
net use
New connections will be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK \\abc\def Microsoft Windows Network
The command completed successfully.
net use \\abc\def /DELETE
\\abc\def was deleted successfully.
net use
New connections will be remembered.
There are no entries in the list.
Then go to 控制台\使用者帳戶\認證管理員
, clear your credential.
Disconnect to internet, try to access your network sharing on disconnection, and then connect to internet.
I can't unhide my folders using folder options
attrib -h -s /s /d "/path/to/folder"
7-zip - how to use command line to include/exclude large list of files
Add to a 7-Zip archive: How to exclude certain file types/extensions?
7z.exe a Archive.7z . -r -x!*.avi -x!*.mp4 -x!*.pcd -x!*.ply -xr@"merged.txt"
netstat -ano | findstr <port_number>
tasklist | findstr <pid>