Right click menu on windowsXP in background: new file types - windows-xp

I would like to remove all file types but one from right click menu resulting on right-clicking on background in windows XP (and then going to "new").
I tried HKCR ->Directory ->Background->sheelex in the registry and there is "new" item but it just have one value.
The problem is I have like 20 file types there but I only need one to save time looking for that .txt every time (to be sure no random stuff is added to new file, I am editing extension myself every time anyway).
Where do I find content of this menu ?

This topic is explained here: Extending the New Submenu
http://msdn.microsoft.com/en-us/library/windows/desktop/cc144101(v=vs.85).aspx#new
To do the opposite, you need to search the registry for below key:
HKEY_CLASSES_ROOT\.XXX\ShellNew
Where XXX is a file extension name. e.g.: bmp, rtf, txt, etc.
You can do this by using below batch file.
#ECHO OFF
REG EXPORT HKEY_CLASSES_ROOT "%TEMP%\REGLIST.TMP"
FIND /I "\SHELLNEW]" "%TEMP%\REGLIST.TMP"
DEL "%TEMP%\REGLIST.TMP"
PAUSE
It will show something like this.
[HKEY_CLASSES_ROOT\.doc\ShellNew]
[HKEY_CLASSES_ROOT\.dpp\ShellNew]
[HKEY_CLASSES_ROOT\.Hxs\Hxs\ShellNew]
[HKEY_CLASSES_ROOT\.lnk\ShellNew]
[HKEY_CLASSES_ROOT\.rtf\ShellNew]
[HKEY_CLASSES_ROOT\.txt\ShellNew]
[HKEY_CLASSES_ROOT\.zip\ShellNew]
Note that not all ShellNew subkey will be displayed on the New submenu since it must follow the requirements as decribed in the above link.
To remove the New File menu entry, delete the ShellNew registry subkey.
For example, if the file extension name is dpp, then registry key would be:
HKEY_CLASSES_ROOT\.dpp\ShellNew
And to remove the ShellNew subkey, you can use Registry Editor or the command line REG tool.
For REG example:
REG DELETE HKEY_CLASSES_ROOT\.dpp\ShellNew

Related

Remove properties from files in powershell

I need to remove all properties (title, author, camera,...) from files in one folder with PowerShell (in Windows 10). Is that even possible or any simple command to do that or would I need to remove each property one by one?
If you need a simple one-off solution or occasional solution Windows explorer has this function built-in.
Select all your files in the folder.
Right click one and select Properties then Details tab.
Bottom of Properties has "Remove Properties and Personal Information"
--Has options to create copies of files with properties removed
or remove from active files. Select properties individually or Select All.

Rename file with the information available in it

Issue - I have this large batch of pdf, word & notepad files which are required to be renamed according to the text available in each file.
For eg: I have to open file A, search the entire document for the string which will be used as its name, copy, close the file and rename the file.
After searching for some while I found that autohotkey can help me with this though I'm open to every solution. What I want to do is open the file, search for the name, select the text and use the keystroke to close and rename the file.
Could anyone help me with this?
I'm not going to give you a script but what you want can be done.
You need to collect various pieces of information when you rename a file. One of them being the current file name which you can often grab from the window title. You can use https://autohotkey.com/docs/commands/WinGetTitle.htm
If a filename is wrapped in [ ] you can remove those using https://autohotkey.com/docs/commands/StringReplace.htm
If you know the file path (folder where the file resides in) you can now use https://autohotkey.com/docs/commands/FileMove.htm to rename a file and use https://autohotkey.com/docs/misc/Clipboard.htm as a variable.
You would probably like to retain the extension (.doc, .txt, .pdf) so you can use https://autohotkey.com/docs/commands/SplitPath.htm to grab it and append that to the clipboard when you rename it.
Closing a file depends on your program, sometimes you can send ctrl+w or ctrl+w or you need to use the WinClose command so you need to add in that step before you use FileMove.

How to rename multiple files in vscode (visual studio code)?

I wonder, if there is way to rename multiple files in visual studio code? I have tried to use find and replace, no luck.
Here is how you can do it on Mac. Right-click (or ctrl+click or click with two fingers simultaneously on the trackpad if you are using a MacBook) on the folder that contains the files that you want to have renamed. Then click Reveal In Finder. Then from within finder select all files you want to rename, right-click the selected files and choose Rename X items.... Then you will see something like this:
Insert the string you want to find and the string with which you want to replace that found string and hit rename. Done 🔨
There are a few Visual Studio Extensions that try to provide this functionality.
The first two I tried did not appear to work. There is an extension called Batch Rename which worked for me: https://marketplace.visualstudio.com/items?itemName=JannisX11.batch-rename-extension.
Here is how the extension works.
You highlight the files in the explorer, right-click, and select Batch Rename
The extension creates a text file with the names of the files you want to rename, one each line. Update the text file with the new names
Save the temporary text file from step 2 and the extension performs the rename.
VS Code only supports single file name. On Windows, to do batch rename, you can use one of the following
[CMD]
// Change the extensions of all .doc files to .txt
ren *.doc *.txt
// Replace the first three characters of all files starting with 'abc' by 'xyz'
ren abc* xyz*
[PowerShell]
Get-ChildItem *.txt | Rename-Item -NewName { $_.Name.Replace('.txt','.log') }
A comprehensive tutorial can be found here
brew install rename
rename s/foo/bar/g **/*
Not an option for Visual Studio Code (yet)...
...but in Sublime Text with the dired package you can enter rename mode with Shift + R.
This gives you a buffer with each file on its line:
D:\path\to\myfolder
first.file
second.file
third.file
...
umpteenth.file
Rename files by editing them directly, then:
Ctrl+Enter = apply changes
Ctrl+Escape = discard changes
While in rename mode you can use the full power of the text editor: edit all filenames at once with multiple cursors, transpose strings (to accomplish switch renames in one fell swoop), find and replace, the Text Pastry package can give you number ranges etc.
vscode-dired will not let you do this, renames are one by one.
You can not rename several files at the same time in vscode,.
The simplest way I found is using the free "everything" utility, it takes seconds to rename a bunch of files in one or several folders.
Open "everything" and filter the file list.
Select the files you want to change
pick "Change Name" with rButtom
Popup will display with old list, the new list, the old names and the new names, if you change the new name, the new list will change accordingly.
VS Code has no such type of facility yet or extension on it. But using vs code terminal as a cmd and run this command on the folder where you want to change all file names from one to another like I want to change my all view files from HTML to PHP.
rename *.html *.php
Renaming multiple files with a single shot is also called batch renaming.
This can't be done from within Visual Studio Code.
There are two ways to get what you want:
(A) Rename files one by one
Go to the Explorer view in VS Code's Side Bar.
Select a file you want to rename.
Press F2 or choose Rename from that file's context menu.
Continue with step 2 as long as there are files you want to process.
(B) Batch rename multiple files using other tools
Go to the Explorer view in VS Code's Side Bar.
Select a file you want to rename.
Press Alt+Ctrl+R or choose Open Containing Folder from that file's context menu.
This brings up the file explorer of your operating system.
Batch rename the files from there. How this is done in detail is beyond the scope of this answer (most of the time, it is just selecting all files to process and starting the rename-tool).
Perhaps the easiest more detailed way is by using VSCode Terminal tab (Ctrl/Cmd + J) and selecting from the dropdown menu the Powershell option:
Based on Kin's answer and the resource Kin provided (2nd page), in order to look into the current and all sub-folders, these are some useful renaming possibilities:
Extensions rename
ls -R *.txt | Rename-Item -NewName {[io.path]::ChangeExtension($_.name, "log")}
Selects txt files and renames their extensions to log.
Name+extension rename
Get-ChildItem -R *.txt | Rename-Item -NewName {$_.name.Replace('.txt','-text.log')}
Selects txt files and renames them to [ORIGINAL_NAME]-text.log.
NEW_NAME+NUMBER+extension rename (original names are discarded)
Get-ChildItem -R *.txt | %{Rename-Item $_ -NewName ("NEW_NAME-{0}.log" -f $nr++)}
Selects txt files and renames them to [NEW_NAME]-NUMBER.log.
How it works:
ls, an alias of the Get-ChildItem command (equivalent in Powershell), lists current directory files;
-R option allows the recursive lookup to happen;
listing result is piped into a multiple Rename-Item commands invocation.
You can rename a statement "in all files" highlighting it and then pressing "CTRL+R" and "CTRL+R"(again). That will replace the selected word/statement in the entire file and (if you don't disable the tooltip checkbox) in all other files where it matches.
I'm not sure if this answer your question, because this is for the text inside the files, not for the filenames.

How to change Excel 2013 Template Miniature

Is there a simple way to change / replace the automatically generated Template Miniature with a different image.
I have checked this out for Excel 2016 but the process is similar.
First, the thumbnail is generated and part of the file. There is no official process. A description for brave Office pros is shown below.
You can do this:
First, close Excel!
Get to the location of your template
Make a copy
Rename the file extension to .zip
Unzip the file into a new folder using the Windows Zip utility
Search the tree of files for a file called thumbnail.wmf
Open PowerPoint and create an empty presentation
Use the function "Insert an Image" and add the thumbnail.wmf to the slide
Remove everything else from the slide
Try to ungroup - it fails with a message asking to convert to a drawing object
From here you have two options. Either convert, ungroup, change and proceed or throw away and create a new image from scratch.
Work on image and group your image (the old or a new one), then
Right click on the grouped image and click "Save as picture"
Choose the filetype "wmf" and name it the same as before and overwrite the existing thumbnail.wmf
Go INTO the folder using Windows Explorer of unpacked files, hit Ctrl-A (Select All)
Right click and say "Send to" --> "Compressed (zipped) folder". Give it a new name.
Hit F2 to rename the file
Remove the file extension .zip
Now, open Excel!
Hit "New", "Personal" and you see your template with your custom image in full width and height. Repeat steps 10 to 16 until you're satisfied.
Drawbacks: Once you edit your file in excel and save as template with thumbnails option (advanced properties) switched on, Excel will overwrite your custom wmf-file. You have to repeat the steps "Unpack -> Replace File -> Pack" every time.
I'll post an update once I found a better solution.
Here is an automation of the process that might help with understanding the process described in the answer.
Python 3 code snippet
import zipfile
import shutil
exfilename = 'MYTEMPLATE.xltm'
a_path='C:\\TEMP'
th_path='mythumbnail.wmf'
with zipfile.ZipFile (exfilename, 'r') as zf:
#Extract to temporary folder
zf.extractall(a_path)
#replace the thumbnail
shutil.copyfile(th_path,a_path+'\\docProps\\thumbnail.wmf')
#remake the zip as a new file
shutil.make_archive('TEMP_ARCHIVE','zip',a_path)
#rename back to original, replacing original
shutil.move('TEMP_ARCHIVE.zip',exfilename)
#clean-up temporary files
shutil.rmtree(a_path)

How can I open a specific node of a CHM (Windows Help) file in the command line?

Specifically, the CHM help file I'm thinking about is the PHP User Manual. I would like some way to be able to open this file directly to a given function reference (node) in the document. Like this:
C:\> php_manual_en.chm json_encode
Only that ↑ syntax isn't correct -- that just ends up opening the manual to the TOC. Can CHM files accept command line arguments? Is there some way to open them directly to certain nodes?
Try to extract your favorite topic address (URL) from the CHM help viewer window and copy to the clipboard:
mk:#MSITStore:D:\php_manual_en.chm::/res/function.json-encode.html
Copy into the cmd text box and press ENTER - the single topic opens in IE (see attached snap 1)
Add a praefix hh.exe for using the CHM help viewer like:
hh.exe mk:#MSITStore:D:\php_manual_en.chm::/res/function.json-encode.html
You'll see the help viewer with Table of Contents (TOC) in the navigation pane and the topic.
Snap 1
Snap 2