NTAdmin


##########################################################
Alternative to putty: https://www.iterminal2.com
##########################################################
Win10 can't ping -6 linklocal address... crazy town


##########################################################
Disable firwarell from the command line
netsh advfirewall set allprofiles state off
##########################################################
AutoHotkey - automate the clicking of things
ahkscript.org
Make a *.ahk file
compile .ahk to .exe
Run->shell:startup
Copy or make shortcut to your program here.
##########################################################
Windows uptime
Console: systeminfo | find /I "Boot Time"
Console: net stas server OR net stats workstation
##########################################################
Wix is great for making installers,
but this plugin lets you use your setup projects
https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d
##########################################################
Windows 8.1 or 10
Create a folder anywhere on the main file system.
Name: GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
Double click to see a bunch of utilities in one place
##########################################################
start remote desktop from command line on windows
mstsc

start remote desktop from command line on linux
rdesktop -u 'mydomain\myuser' -p 'mypass' -g 80% ip-of-win -5 -K -r clipboard:CLIPBOARD

##########################################################
Open windows explorer and navigate to your favorite directory
Open Windows commnad prompt there by typing:
   Alt-d
   cmd
   

##########################################################
2015-10-12:  apt-cyg is a Cygwin package manager.

REF: https://github.com/transcode-open/apt-cyg
I love this as it offers a non-gui package installer for cygwin, 
so I can ssh to a windows machines, do my stuff, and never click a mouse.


##########################################################
2015-09-17: View json in IE

Microsoft is awesome, and IE (Edge) is their flag ship product.

To view json in IE, ... drum roll ..., you must edit the registry.

This worked for me:
https://weblog.west-wind.com/posts/2011/Apr/01/Displaying-JSON-in-your-Browser

Run regedit.exe

Browse to HKEY_CLASSES_ROOT\MIME\Database\ContentType

Right click ContentType -> New -> Key
  Name it 'application/json'

Select 'application/json'
  In the right pain, Right click -> New -> String -> 'CLSID'
    Double click 'CLSID'
      Data value:  {25336920-03F9-11cf-8FD0-00AA00686F13}
Select 'application/json'
  In the right pain, Right click -> New -> DWORD -> 'Encoding'
    Double click 'Endocing'
      Data Value:  Hex ->  80000

Close and save

Start IE, and open a json file

You will see the json.

I am not sure if you need to reboot, but I think IE needs a restart.

It is that easy. I hope this helps you reach your potential.

##########################################################
2014-11-012: Microsoft "open-source" .NET

It will use the MIT license.
https://tldrlegal.com/license/mit-license

M$ promises not to sue over patent infringement, 

Available Source:
https://github.com/Microsoft/referencesource
but they (currently) don't plan to accept patches back, so it's not a
community project yet.

Now we have to get systemd to migrate to .NET, 
"Join me, and I will complete your training." 


##########################################################
REF: My notes are from here

Install Python(2.7) on windows:
  https://www.python.org/downloads
  Click Downloads -> select the 2.7 -> run installer.
  Install: c:\Python27 

  Add new Environment variable PYTHON=c:\Python27
  Add to Environment PATH, %PYTHON%;%PYTHON%\Scripts

Install pip:
 NOTE: I had another pip on my system, belonging to perl
   so you may have to use a fully qualified path when using pip.
   To see if you have a conflicting pip:
     where pip.exe

  Download: https://raw.github.com/pypa/pip/master/contrip/get-pip.py
  Run:  python get-pip.py
  Installs: c:\Python27\Scripts\pip.exe 

For ipython qtconsole, install pyqt
  RiverBank Computing - PyQt Binary Downloads 
  Install the binary appropriate for your python install (x86 or x86_64)
  At the time of this writing, I see PyQt4-4.11.1-gpl-Py2.7-Qt4.8.6-x32.exe

Install iPython
  c:\Python27\Scripts\pip.exe install ipython[all] 

Launch it:
  ipython qtconsole


##########################################################
Discovered cygwin sets TZ=America/Los_Angeles, which throws off time for any native Windows program launched from the cygwin shell.

I use cygwin to auto-build software, where a windows command shell launches a compiler, and effecting  time(), __DATE__, __TIME__.

I could not figure out why time was off by 8 hours until I found the environment variable TZ was set when things where wonky.

Once I knew what to search for, "Unset cygwin TZ", I found lots of people with this issue.

In this post Christopher Faylor says it's not his problem.

To me this was a ladder laying on the floor in a dark room for people to trip over.

It is known to people in charge of the room, and they aren't going to move it.

They say just unset it once in windows command shell.

Sometimes this isn't easy... 
I guess I can make a diaper (wrapper) script to handle this mess.

##########################################################

in bat files ggetting a date in format : "yyyy.MMdd.HHmm.ss". 
-------------------------------------------
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
echo secs=%secs%

set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
echo min=%min%

set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
echo hour=%hour%

set day=%date:~7,2%
if "%day:~0,1%" == " " set day=0%hour:~1,1%
echo day=%day%

set month=%date:~3,3%
if "%month:~0,1%" == " " set month=0%hour:~1,1%
echo month=%month%

set year=%date:~-4%
if "%year:~0,1%" == " " set year=0%hour:~1,1%
echo year=%year%

set Version=%year%.%month%%day%.%hour%%min%.%secs%
echo Version=%Version%


##########################################################
NTFS trouble shooting
##########################################################
 RIP DVD on Windows.  

1. Download (64 bit) Handbrake for Windows
2. Download the libdvdcss 64-Bit from VideoLan
http://download.videolan.org/pub/libdvdcss/1.2.12/win64/libdvdcss-2.dll
3. Rename the libdvdcss-2.dll to libdvdcss.dll in your Handbrake install
folder. ( C:\Program Files\Handbrake )
4. Start Handbrake, put in your DVD and go from there. 
5. Scan cd drive
6. if everything worked, you can rip a copy protected dvd.


##########################################################
##########################################################

Jump to netowrk settings:
Run->ncpa.cpl

##########################################################

Windows8 is strange:

Start-> is gone.

That's pretty convenient!  Thanks Microsoft.

In it's places, in the lower left corner of the "Task Bar" is a 4 pain window icon.

Right click that sucker to have Run, Manage, and other useful features.

Imporove the left click workflow:
  Richt "Task Bar" (bottom of the screen)->Properties->Navigation
  Check "Go to the desktop instead of Start when I sign in"
  Check "Show my desktop background on Start"
  Check "Show the Apps view automatically when I go to Start"
  Check "List desktop apps first in the Apps view when it¿s sorted by category"

I'm not sure what this is for::
  -R  to run, and paste in %ProgramData%\Microsoft\Windows\Start Menu\Programs


########################################################## Needed a method to convert html to RTF because windows installers need EULA in RTF Pandoc http://johnmacfarlane.net/pandoc/index.html DocFrac http://sourceforge.net/projects/docfrac/
##########################################################
Can't uninstall an msi
This bug happens when a windows users: 
1. installed a msi
2. deleted msi from C:\Users\build\Downloads\
3. deleted msi from C:\Windows\Installers\ (windows auto-generated)
4. choose to uninstall from the "Control Panel"->"Programs and Features"

The big problem is that the user mucked with Windows installer cache
under c:\Windows\Installers.

Apple even has the same issue:
http://support.apple.com/kb/TS3704

First solution:
Download the original installer, open the folder containing the msi,
right click the msi, and choose uninstall.

Second solution:
Follow Apple support instructions (in the link above), followed by
installing the new Mapp installe, although this is messy.
They had me follow these steps:
1. Visit http://support.microsoft.com/mats/Program_Install_and_Uninstall
and click "Run Now".  This downloads their fix-it utility.
2. Run the utility, 
    accept their license, 
    you are trying to Uninstall, 
    choose file problems and let me select which ones to fix.
    Choose the application
    Choose Yes - try to uninstall
The Microsoft tool cleaned the registry, 
and the app disappears from "Programs and Features", 
but all the files are left in place.
While not clean, this did allow me to reinstall the program.


##########################################################
 Generate guids for windwos installers
powershell -Command "[guid]::NewGuid().ToString()"
wmic path win32_computersystemproduct get uuid
guidgen.exe

##########################################################
Install cygwin ssh as serivce on Windows7
1. Install ssh package
2. Start cygwin shell as administrator
   ssh-host-config
   Should privilege seperation be used? (yes/no) yes
   new local account 'sshd'> (yes/no) yes
   Do you want to install sshd as a service? (yes) yes
   Enter the value of CYGWIN for the daemon: []   ntsec
   Do you want to use a different name? (yes/no) no
   Create new privileged user account 'cyg_server'? (yes/no) yes
   Please enter the password:  Foodlez!
   Reenter: Foodlez!
   net start sshd
3. Start cygwin shell as your normal user
  ssh_user_config
  Do you want to use this identity to log into this macine? (yes/no) yes
  Shall I create a SSH2 DSA identity file for you? (yes/no) yes
  Do that for all the keys 

##########################################################
I learned that if you ever have problems with an msi you can run it in debug mode by doing the following:

/msiexec /i myInstaller.msli /l*v myLog.txt

msiexec is standard in xp or better.

/l*v says to run in debug mode

and it stores info into myLog.txt, which you can attach to a bug.

##########################################################
Console2 is a much improved cmd or console app.
I installed mine to c:\dev\utils\Console2\Console.exe

Don't do this: 
   set the environment variables SHELL and COMSPEC
   Control Pannel->Preferences->Environment->
   Replace: ComSpec   %SystemRoot%\system32\cmd.exe
   With:    ComSpec   c:\dev\utils\Console2\Console.exe
After I did this, i had so many error windows it was hard to set back.
I guess Microsoft really doesn't want you to have a better shell.

########################################################## On a windows machine verify that an msi is not signed.
Steps:
cmd
set PATH=%PATH%;"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1\Bin"
signtool verify /v /pa 

    Successfully verified: fee.exe
    Successfully verified: fi.exe

    Verifying: foe.msi
    SignTool Error: No signature found.

    Number of files successfully Verified: 0
    Number of warnings: 0
    Number of errors: 1

##########################################################
I kinda like the windows7 resource monitor.
Start ->Run->%windir%\system32\resmon.exe

##########################################################
Automate install/uninstall in windows7
In windows7 one can automate install/uninstall/repair programs using msiexec.exe

it's usage looks like:
Install:   msiexe.exe /n /passive /i my.msi
Uninstall: msiexe.exe /n /passive /x my.msi
Uninstall: msiexe.exe /n /passive /x {Product Code}

The "Product Code" is a guid "Product ID" I use in Wix to create the msi.

One can find the installed "Product Code" guids in the registry:
Run regedit.ext
->HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
->HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Classes\CLSID

look in there you will see lines that contain: msiexe.exe /n /passive /x {Product Code}

##########################################################
Find Boot time in windows7
Computer Manaagment
->Event Veiwer
-->Application And Service Viewer
--->Microsoft
---->Windows
----->Diagnostics-Performance
------>Operational
shows a BootStartTime: 2013-03-14T10:17:47.812000500Z

##########################################################
killing processes using a file or directory
Download SysinternalsSuite.zip
http://technet.microsoft.com/en-US/sysinternals

Unpack to c:\SysinternalsSuite and put it in your %PATH%.

Explore to where the file or folder is located

Hold shift and right click, select "Open command window here".

From the command shell type:
handle.exe -u 
A list of pids will be shown.

From the command shell, this will kill the pid
pskill.exe 

##########################################################
##########################################################
Add To Exploerer "Open command prompt here"
NOTE: in win7, hold shift while right clicking in Exploer
No extra stuff is required
But this is a reghack
Create file: hack.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd]
@="Open Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd\command]
@="cmd.exe /k pushd %L"

Run by double clicking
Open Exploerer, sleect some folder
File->Folder->Open Command Prompt Here
##########################################################
Recently ran into furstration trying to install nmake on xp (to build pyqwt5 for python 2.7)
Requires .NET 2.0
Error installing Microsoft .NET Framework 2.0 Setup:

Instlaler: dotnetfx.exe

Error 25007. Error occurred while installling fusion.
Setup could not load fusion with LoadLibraryShim().
Error: 0x80131700


Solution: How to manually remove and then reinstall the.NET Framework 2.0
Unregister and then reregister Windows Installer
  Start->Run, type "msiexec /unregister"
  Start->Run, type "msiexec /regserver"

Manually remove and then reinstall the .NET Framework 2.0
  Start->Run, type "installer"
  Right-click the Name column header, and then click Comments
  Right-click the cached Windows Installer file that has the Microsoft .NET Framework 2.0 RTL x86 enu, and then click Uninstall.
  Start->Run, type "system32"
  - Delete  c:\Windows\system32\URTTemp folder
  - Delete  c:\Windows\system32\mscoree.dll file
  - Delete  c:\Windows\system32\v2.0.50727 folder
  Start->Run, type 'microsoft.net'
  - In Microsoft.NET\Framework folder, delete v2.0.50727 folder
  start->Run, type 'regedit'
  - locate and then delete the following registry keys
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v2.0
  start->Run, type %Temp%
  - Delete everyhting

Reinstall the .NET Framework 2.0.
  Run windows update

##########################################################
msi, rmi, msp, oh my - diverse installers for windows
.msp file contains just the difference between 2 MSI files.
extract msi
msiexec.exe /a "[path to .msi file]" /t "[location to extract to]"
apply msp to extracted msi
msiexec.exe /p "[path to .msp file]" /a "[location to extracted msi]"
.MSP can be applied to .msi to generate updated .msi
msiexec.exe /a "[path to .msi file]" /p "[path to .msp file]"
http://blogs.msdn.com/heaths/archive/2006/04/07/571138.aspx
##########################################################
Disk Space Analyzers:
Space Sniffer no install, free, fast.
WinDirStat.exe is a disk usage statistics viewer and cleanup tool for Microsoft Windows.
##########################################################
Zeroconf/avahi/Bonjour on Windows:
Windows doesn't come with DNS Service Discovery (dns-sd).
Install Apples Bonjour Print Services for Windows
This installs some libs and a tool that only shows printers on the network, which isn't enough.
Install Firefox plug-in BonjourFoxy
After installling BonjourFoxy, in Firefox, under Tools menu, you will see Bounjour Browser.
You can also install JDK, then JBonjourBrowser by downloading and running: java -jar JBonjourBrowser.jar
##########################################################
Compilers for windows:
Free:
mingw: "Minimalist GNU for Windows" http://www.mingw.org/

Commercial:
cl.exe : Visual Stidio commad line for .c or .cpp files
C:\Program Files\Microsoft Visual Studio 8\VC\bin\cl.exe
devenv.com : Visual Studio commad line for .sln files:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com

Before running either of those, first run the bat script:
"C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"

##########################################################
Keyboard Shortcuts:

Brows to Start->Programs->Your_Program_Name
Right click Your_Program_Name, Select Properties.
On Shortcut tab, Click 'None' in "Shortcut key:" filed, and press your shortcut to launch this (e.g. Ctrl-Alt-d).
Close and press key sequence (e.g. Ctrl-Alt-d).

For putty, you need to create a shortcut of putty first, then create
keyboard shortcut as before, using shortcut to putty.

##########################################################
Windows needs antivirus, but it should not be a tax:
Malwarebytes
Clamav
AVG
##########################################################
Files in system32 directory copied from http://www.symantec.com/connect/blogs/cwindowssystem32-files-explained
##########################################################
Create shortcut to Edit Domain Users and Groups
Right lick desktop, choose new->shortcut
For program to run enter: mmc.exe %systemroot%/System32/dsa.msc
Name it: Edit Domain Users and Groups
##########################################################
Tools to show shared library (dll) dependencies of exe.
Dependency Walker recommended by QT.
dumpbin.exe (part of Visual Studo).
In dos shell, run: "c:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
now dumpbin.exe will be in your path.
##########################################################
When installing cygwin, try to make it automated
cygwin faq.setup.automated
##########################################################
If you try to run make.exe in cygwin, and recieve the error
Makefile:14: *** missing separator. Stop.
this error can be caused by calling incorrect make binary.
Try to prepend path to your make.exe to the path.

##########################################################
Cygwin terminal: rxvt
Supirior to native terminal.
Setup:
1. Create bat file: C:\cygwin\home\Your_User\bin\rxvt.bat
Bat file contents:
@echo off
REM place in C:\cygwin\rxvt.bat and put
REM a shortcut on the desktop :-)
REM NOX
c:\cygwin\bin\rxvt -e /bin/bash -login
REM WITH X
REM DISPLAY="$DISPLAY.0" c:\cygwin\bin\rxvt -e /bin/bash -login
REM DISPLAY="$DISPLAY.0" c:\cygwin\bin\rxvt -sr -sk -backspace ^? &

2. Create shortcut on your desktop to the bat file
Target: C:\cygwin\home\You_User\bin\rxvt.bat
Start In: C:\cygwin\home\Your_User\bin

Change font and background in c:\cygwin\home\Your_User\.Xdefaults
#ifdef COLOR
*customization: -color
#endif
XTerm*background: black
XTerm*foreground: orange
XTerm*highlightColor: red
XTerm*cursorColor: yellow
XTerm*saveLines: 30000
XTerm*scrollbar: true
Rxvt*font: Lucida Console-14
Rxvt*background: Black
Rxvt*forground: Orange
Rxvt*savleLines: 300000
-- or--
rxvt*background: Black
rxvt*foreground: Orange
rxvt*scrollBar: true
rxvt*scrollBar_right: true
rxvt*font: -bitstream-bitstream vera sans mono-medium-r-normal--*-120-*-*-m-*-iso8859-1
rxvt*boldfont: -bitstream-bitstream vera sans mono-bold-r-normal--*-120-*-*-m-*-iso8859-1
rxvt*saveLines: 300000
rxvt*loginshell: true
rxvt.backspacekey: ^H

##########################################################
Having problems running nedit when sshed to cygwin host
1. Make sure forwarding isn't disabled:
chmod 666 /etc/sshd_config
vi /etc/sshd_config
Set: X11Forwarding yes
chmod 644 /etc/sshd_config
2. Make sure xauth is installed
Run setup.exe
Select keep, then search for xauth, and install
3. edit ~/.bash_profile or ~/.bashrc
Add seciton like this:
# The next line fixes a bug in running nedit over ssh.
# Error:
# X Error of failed request: BadMatch (invalid parameter attributes)
# Major opcode of failed request: 70 (X_PolyFillRectangle)
# Serial number of failed request: 291
# Current serial number in output stream: 301
#
export XLIB_SKIP_ARGB_VISUALS=1

##########################################################
Set history to something resonable
edit ~/.bash_profile
Add seciton like this:
# configure history editing
set -o vi
export HISTSIZE=1000
export HISTFILE=~/.history
export HISTFILESIZE=1000
export EDITOR=vi

##########################################################
Best Windows Tool: "Computer Management" or compmgmt.msc
Or right click my computer->manage
##########################################################
Good merge utility for windows (but free): DiffMerge
Good merge utility for windows (but not free): araxis merge
##########################################################
Good Free zip utility for windows: Tugzip
########################################################## Internet Anonimity:
thunderbird_portable
firefox_portable
Tor: (side step the office proxy/monitoring)
http://en.wikipedia.org/wiki/Tor_(anonymity_network)
Tor on usb:
http://anonymous.livelyblog.com/2007/03/15/operator-a-great-way-to-make-your-own-tor-usb-keystick/

##########################################################
Tugzip - Free zip program
##########################################################
araxis - Non-Free Good diff tool
##########################################################
Found blog about running network Control pannel as different user,
since runas doesnt' work
Needing Explorer as admin

##########################################################
automate runas such that no password must be typed in manually,
REFERENCE: Why doesn't the RunAs program accept a password on the command line?
http://blogs.msdn.com/oldnewthing/archive/2004/11/29/271551.aspx
Summery: It was a design decision, because they didn't want people to do insecure stuff,
and because it would have added too many options to the runas UI.
Systeminternals was bought by M$, but the free tools are availble:
http://microsoft.com/technet/sysinternals/
Download the http://download.sysinternals.com/Files/PsTools.zip

##########################################################
Use JXplorer to brows your active directory LDAP,
And try to change some values, to test security.
You will need a client (aka JXplorer)
server: kdc.my.microsoft.domain
protocol: ldap v3
base dn: DC=my,DC=microsoft,DC=domain
Level: User+passwd
User DN: CN=Joe Smith,CN=Users,DC=my,DC=microsoft,DC=domain
Passwd:

##########################################################

Access is Denied installing XP sp2
Customize XP install CD
Free dhcp and tftp server for win32
Free libpcap and tcpdump for win32
BartPE - LiveCD of windows
Windows Terminal Server Printing
Windows Freeware Resource Kit
Windows hidden shtuff
Captive: The first free NTFS read/write filesystem for GNU/Linux
Copy of :http://security.tombom.co.uk/shatter.html
JSI, Inc. - Your Windows NT ® Resource
Winmag - Online Tips Db
NTBugtraq - Open Letter: Safe Email Practices
Advanced Disk Catalog, password recovery software, e-mail management software,advanced registry tracer
Winternals Software - Advanced System Tools
EarthWeb ITKnowledge Home Page
Experts Exchange, the #1 Knowledge Sharing Community on the Web.
Remote Administration of NT with webconfig
Remote Administration of NT with Hyena
Win2k SP2
win2k101.txt
Windows Patches
Holiday Dancer for winamp
ZoneAlarm - firewall type stuff for windows
Ad-Aware - Lavasoft helps you clean-up your windows system.
COMMUNICATE! PRO - Manage e-mail, faxes, and voice mail.

Commands to Remember: taskmgr, eventvwr, dcpromo, compmgmt.msc,

Problem: Acrobat Reader hangs when starting or reports that it can't create a temporary file. Accrobat reader creates a few of temp files for each file opened:

     C:\Documents and Settings\\Local Settings\Temp\Acr[0001-FFFF].tmp
They are all zero bites, but they are not always cleaned up in NT4/Win2K/Win2003/XP. After you have 65,535 of them, accrobat reader 6 will hang on opening, and 5 reports that it can't create a temp file. Deleting all the Acr*.tmp files solves the problem, but windows will hang if you try to delete all of them at one time. funny stuff.

 To join a domain from cli:   NETDOM /Domain:MYDOMAIN /user:adminuser /password:apassword MEMBER MYCOMPUTER /JOINDOMAIN

Disable last-accessed-time, regedit: HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate

##########################################################
Procedure to automate network switch on XP via batch files
1. Set network settings via network control panel for static IP on fake
subnet.
2. Save the config to a file by running:
    netsh -c interface dump > c:\net_fixed.txt
3. Set network settings via network control panel for dhcp IP.
4. Save the config to a file by running:
    netsh -c interface dump > c:\net_dhcp.txt

To load a settings file for one of the networks above:
  netsh -f c:\net_.txt

5. Create bat scripts on desktop, so you can switch network config by
clicking:
i.e. dhcpnet.bat
   @echo off
   c:
   netsh -f c:\net_dhcp.txt

i.e. fakenet.bat
   @echo off
   c:
   netsh -f c:\net_fixed.txt
Procedure to reinstall XP without re-activating
##########################################################
The trick is to backup and restore 2 files:
C:\Windows\System32\wpa.dbl
C:\Windows\System32\wpa.bak

##########################################################
Backup and restore the registry
MS Article ID: 307545
md tmp
copy c:\windows\system32\config\system c:\windows\tmp\system.bak
copy c:\windows\system32\config\software c:\windows\tmp\software.bak
copy c:\windows\system32\config\sam c:\windows\tmp\sam.bak
copy c:\windows\system32\config\security c:\windows\tmp\security.bak
copy c:\windows\system32\config\default c:\windows\tmp\default.bak

delete c:\windows\system32\config\system
delete c:\windows\system32\config\software
delete c:\windows\system32\config\sam
delete c:\windows\system32\config\security
delete c:\windows\system32\config\default

copy c:\windows\repair\system c:\windows\system32\config\system
copy c:\windows\repair\software c:\windows\system32\config\software
copy c:\windows\repair\sam c:\windows\system32\config\sam
copy c:\windows\repair\security c:\windows\system32\config\security
copy c:\windows\repair\default c:\windows\system32\config\default