Windows/DOS commands
DOS/CLI commands
xcopy d:\ z: /s /e /c /f /z /h # xcopy from d: to z: , include sub dir, hidden file, etc.
robocopy s:\source\folder1 d:\destination\folder2 /e /move /copyall /tee /log+:robo.log /w:1 /r:2
# Robust copy, lot of options, separate tool from MS?
# /move = move files and dirs (hopefully not copy and delete if on same FS)
# /copyall = copy NTFS ACL, owner, and audit info also (these are not included by default)
# but if ACL cannot be copied, copy will fail (reported)
# /e = include sub dirs, even if empty
# /tee /log+:robo.log will do a "T" and append to log file
# /w:1 /r:2 = wait 1 sec before retry, max 2 retries
# (good if know waiting won't help unlock file, or will do multi-scan)
#
#
# Note that folder1 itself won't be moved, it is the content inside the folder
# It is more like folder1\* to folder2.
# But folder1 itself will be deleted if /MOVE is used.
# Don't think too much like Unix!
# Additional notes:
# File that cannot be moved (cuz it is locked)
# is not reported as error in summary (but as skipped?).
# But instead of whining and stopping if using the Win Explorer GUI,
# Robocopy will continue to move the next file.
#
# Files created after Robocopy completes its indexing are not touched.
#
# Redirecting output to a log file is good, as it is quite verbose.
# \\unc\path can be used.
#
# files that already exist in the destination are reported as EXTRA
# can be /purge if desired.
cacls = change acl's. NT cli version of solaris setfacl.
compact = file compression util (list, maybe set?)
rdisk = nt4 create emergency recovery disks (erd)
regback = registry backup (add on?)
type file | find /i "string"
# equiv to unix cat file | grep -i string
# the quotes MUST be used or
# find will complain with weired error message!
# /i = case Insensitive grep.
type file | findstr /i "string"
# similar to find above, but different binary...
title any text string desired
Set the DOS CLI window to have the desired title
bgjob prog arg
run bg job inside a telnet session
so that even if telnet goes away, job remains.
There is still probably a nohup.
net use R: \\host\share password /user:DOMAIN\USERNAME
map network drive; funky session weireness, watch out use in script
net view
net user USERNAME PASSWORD /add
add user
net statistics server # info about uptime, etc
---
windows network stuff
tracert
nbtstat -n = list all comp (NetBIOS name, WINS)
nbtstat -c = clear the cache
nbtstat -RR = Release and Reregister NetBIOS name with WINS
NetBIOS names can only be 15 chars long. The 16th char encode the NetBIOS Suffix.
A list (albeit not comprehensive, at least 4F is not listed) can be found at
http://support.microsoft.com/kb/163409
All code in hex
00 = Workstation Service
03 = Manager Service (allow MMC to connect to it?)
1B = Domain Master Browser, defined for a domain rather than a computer
1C = Domain Controllers, defined for a domain
20 = File Server Service
netsh (shell for config of dhcp, ras, wins, routing) [w2k]
runas
set # display system environment
# LOGONSERVER is the Domain Controller the machine is currently talking to
# Other interesting variables displayed by set:
# USERNAME, USERDOMAIN
# PROCESSOR_ARCHITECTURE
----
network browser cmd (some gui stuff) in Resource or Supplement kit.
net config rdr, see network device info, eg NetBT_E100B1
then,
browstat gb NetBT_E100B1
tell which one is the master browser in the network.
browmon
GUI browser monitor. similar to above
browstat status
browstat view NetBT_E100B1 NTDOM1
browstat getpdc NetBT_E100B1 NTDOM1
other obscure stuff, w2k only?
browstat dumpnet
netusers \\computername /history
# see who has logged in to a given machine
mmc # win magement console,
# many plugin, eg computer mgnt
# customizable and store them as .msc file
http://www.windowsnetworking.com/kbase/WindowsTips/Windows2003/AdminTips/Admin/LaunchAdminToolsfromtheCommandLine.html
nt4 / w2k reousrce pack
shutdown
\\computer : remote computer to shutdown (local if omitted)
/A : abort shutdown
/R : reboot
/T:xx : wait xx secs (def=30)
msg : message to user of shutdown
/C : force running app to close
Windows Startup
windows program auto load, from registry instead of Startup folder:
regedit
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
TLA:
HKCU HKEY_CURRENT_USER
HKLM HKEY_LOCAL_MACHINE
each program has an entry with full path as value, delete individually as needed.
XP has a System Configuration Utility under control panel | help support
section, so that all current startup places are listed and can be turned off via uncheck.
Many of these can be recognized as normal software, but just always run
at startup, which becomes anoying.
Some spyware may also add hooks here, but if they are really good,
spyware may replace legit system file and it will need a tool to check
if it is really spyware or the legit file!
Probably legit programs (could still be replaced by spyware!):
HKLM...Run mobsync.exe /logon. Sync Manager
KHCU...Run ctfmon. Office2003 text2speech [potentially key logger]
Additional crap that is loaded somehow...
C:\Program Files\Common Files\Real\Update_OB\
apperently lot of .dll and .exe which somehow get executed
rnms3270.dll is the realone messanger center crap that do lot of pop up messageging ads. Delete or rename them!
---
Internet MIME programs (may load all the time)
C:\winnt\Downloaded Program Files\
Each control has its own entry, right click and then choose remove
(eg, will see DBFullInst Control for the stupid SpyWare program).
---
SpyBot AntiSpyware program has tool that list all program that will be
loaded up at boot time and allow single click disactivation.
Cool SA tools
WinDirStat
Get it from sourceforge.net, a program that will collect disk stat usage (network share ok),
keep track of subfolder disk usage, and also give aggregate of files type usage
(eg mp3, m4a, avi, pst, zip, etc).
Unixfying Windows/DOS
- Cygwin add a lot of standard unix tools, libraries, etc. Includes a bash shell and X Window Manager for running X-based (GUI) apps.
- MKS Toolkit. This actually pre-date cygwin, but this is moneyware.
- SFU Microsoft Services for Unix. Add NFS client and server, telnet server, and other tools to bridge Unix and Windows machines. In the same manner that Samba teaches Unix to talk Windows, SFU teaches Windows to talk Unix.
"LYS on the outside, LKS in the inside"
"AUHAUH on the outside, LAPPLAPP in the inside"