how to open or read copied system registry file without import in windows 10 - windows

I have copied system registry file C:\Windows\system32\config\system from another windows machine (VM). And I want to open it and list out some keys from "...\ControlSet.." I open the Regedit and tried to open it but Regedit showing me the option of import which giving the warning that the registry keys ill be get replaced.
So I want to open it with PowerShell if not possible then want some tool to open the file and list out the required keys from it.

In your PowerShell script, you can use reg load/unload to automate what you described above.
$null = reg load HKU\CustomFolderName "c:\path\SYSTEM.DAT"
...
script code here
...
$null = reg unload HKU\CustomFolderName

Found one way is using Load Hive Option in Regedit.
Select the Hive HKEY_LOCAL_MACHINE or HKEY_USERS then
'File > Load Hive' then select the file to load then
Write the path or name of the key in the opened dialog box.
If the key does not exist in the selected hive it will create key and will load the
selected file under it.

Related

I want to know how to change "Folder Options" using a batch file

How to enable hiding and viewing system files "in general" using a batch file?
I have researched on the net and found these results such as: ATTRIB -S -H RECORD.TXT
But this is "specific" to a file... I want to know how to do this for the explorer. Basically how to manipulate these options in "Folder Options" using a batch file.
As described in this question Configure Windows Explorer Folder Options through Powershell
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
There are various values in this key that control the options. You can manipulate them through a batch file (rather than powershell) using reg.exe.
Easiest way would be to set the options you want in the GUI, export the key to a .reg file, then use reg.exe IMPORT settings.reg

How to suppress 'Open with' window

When running a file which has an unknown extension (lets say test.nope) from the command line or a batch file - using test.nope, call test.nope or start test.nope - you are presented with a window asking you to "Choose the program you want to use to open this file" (in Windows 7, presumably in most Windows OS's).
Is it possible to suppress this window?
My initial thought was to check if the extension exists in the %PATHEXT% variable before attempting to open the file. However, this does not contain all known file extensions. For example, though the .py extension is not in my %PATHEXT% variable, Python scripts are still opened correctly.
An alternative to a direct registry query (as suggested by #Mitch) is to use the command line utility assoc
assoc .nope
If there is no application registered for the file extension it produces
C:\>assoc .nope
File association not found for extension .nope
If an association is found (for instance, for the .docx extension), it produces
C:\>assoc .docx
.docx=Word.Document.12
You might also find ftype useful. It returns the command line for the file type returned by assoc (I have Office installed in a non-default location, as you can see):
C:\>ftype Word.Document.12
Word.Document.12="D:\Microsoft Office\Office12\WINWORD.EXE" /n /dde
File types are registered in HKCR\ (full documentation available from MSDN). You can find out if a type is registered by checking for the existence of the key. In a batch file, you could use the reg command to do so.
reg query HKCR\.txt || echo This will never print
reg query HKCR\.foobartxt || echo Could not find foobartxt
That being said, file types can be defined and named without having a default handler. Further, those which have default handlers may not have command lines - the file may be launched via DDE or COM.

Regedit: Find and export keys from command prompt

I'm wondering is there any option via command line to search for a string and export all found keys in Windows registry?
Ex:: If you want to check whether "HKLM\software\etc" key exists.
reg.exe query "HKLM\Software\etc" will return all the subkeys and values in command prompt if found or an error if not found.
ALso, you can directly do
reg.exe export "HKLM\software\etc" "C:\etc.reg"
This will export the registry key and subkeys if found otherwise error if not found.
Powershell has registry iteration capabilities. Start here: http://technet.microsoft.com/en-us/library/ee176841.aspx
export key (with all sub-keys), from CMD (or RUN) i.e.:
regedit /e c:\output.reg "HKEY_LOCAL_MACHINE\System\YourLocation"
p.s. you should run this in CMD with ADMIN PRIVILEGES. for that, right click on START>Run CMD (as Admin)

Windows Shell Context Menu option

I need to create an option for all files that would run a batch file located in Windows directory or any other directory.
The batch file will basically delete the files and will also delete it from another server.
I have the batch file working just need the context menu option.
You have to create the following registry entries:
HKLM\Software\Classes\*\shell\yourappname
HKLM\Software\Classes\*\shell\yourappname\command
the first registry entry is a key, the second a string value. Set the value of the command entry to the path of your batch file, e.g. "c:\batch.bat %1"
The '%1' will get replaced by the path the context menu was shown for.
The '*' entry is for all files. If you want your menu to show up for folders/drives/whatever, you have to also add the same registry keys/values for those too, e.g.,
HKLM\Software\Classes\Folder\shell\yourappname
HKLM\Software\Classes\Folder\shell\yourappname\command
HKLM\Software\Classes\Directory\shell\yourappname
HKLM\Software\Classes\Directory\shell\yourappname\command
HKLM\Software\Classes\Drive\shell\yourappname
HKLM\Software\Classes\Drive\shell\yourappname\command

RunTime Error '70' Permission Denied in VB6

I am using VB6. The tool that i have created extracts few zip files and unzips them onto a folder that i create locally.In the clean up part of my code, i have deleted the folder using this code
If (f.FolderExists(path + "Extracted Files") = True) Then
f.DeleteFolder (path + "Extracted Files")
End If
When i run this code, i get an error Run Time Error '70' and Permission Denied in the line f.DeleteFolder(path + 'Extracted Files').
Where am i going wrong ? Or do i need to create the folder with a different permission ?
Perhaps one or more of the files is read-only? Use the optional force parameter to force deletion:
f.DeleteFolder (path + "Extracted Files"), True
You are using a library written in another language to extract the files? Verify that any pointer was open, it is likely that some file is opened, good luck!
Run Registry Editor by typing regedit in Start Search or command prompt.
In Registry Editor, navigate to the following registry key:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
Locate the following DWORD registry subkey in the right pane: EnableLUA
Double click on EnableLUA
On value prompt, set value to 0.
Exit from Registry Editor.
Restart the computer.
To enable the UAC again, set value of EnableLUA to 1.

Resources