How do we use the ProgID column in the File Associations settings? - deployment

I'm deploying my application using ClickOnce.
I want to register a file association but I can't manage to make it work: What should I use as ProgID in the File Associations section of the Publish Options?

It's a name that uniquely identifies the file type. So a description might be "Document created with Microsoft Word" and the ProgID might be "Word". If your app name is short, you can just put that in there. If your app name isn't short, put in some abbreviation of it.

Some examples from the registry subkeys
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ ~ \OpenWithProgids:
.bmp - Paint.Picture
.csproj - VisualStudio.Launcher.csproj.15.0
.csv - Excel.CSV
.docx - Word.Document.12
.mp4 - WMP11.AssocFile.MP4

Related

PowerShell - How to programmatically determine which registry keys a Group Policy Object modifies?

As the title, how to automatically map GPOs to their corresponding Windows registry values in PowerShell?
I am now very experienced in PowerShell, but determine which registry value is modified by a GPO with PowerShell is still a little bit too hard to me, currently I am able to use Process Monitor to create custom filters to only include activities of mmc.exe gpedit.msc, then use Tools->"Registry Summary" to get registry entries modified by gpedit.msc, then I can export the entries to a .csv file and import it in powershell and do further commands, but this method doesn't show which registry key is modified by a GPO, so I have to manually change a GPO and switch to "Registry Summary" to see which registry entry is modified by the last GPO change, this is very inefficient; I am aware there are some existing group policy to registry mappings, but they are incomplete.
So how can I determine which registry entry is modified by a GPO in PowerShell? Any help is appreciated.
Update
As far as I know, Windows Group Policy definitions are *.admx files stored in C:\Windows\PolicyDefinitions folder, and the localization files that make the policy definitions be displayed in gpedit.msc are *.adml files with the same name of corresponding *.admx file stored in a subfolder named the language code of the locale (i.e. en-US) inside C:\Windows\PolicyDefinitions folder, all information about the group policies should be in them, so if I can parse these files, I can map GPOs to their equivalent registry keys.
Just opened one of the .admx files in Notepad++, and found out these files are encoded in plain text, completely human readable, they are just .xml files renamed, so it's easier than I thought...
I am trying to write a PowerShell script that does this mapping thing...
UPDATE1
So far I have achieved these:
[xml]$xml=get-content C:\Windows\PolicyDefinitions\AppXRuntime.admx
$xml.policydefinitions.policies.policy[0].name
$xml.policydefinitions.policies.policy[0].key
Of course when actually running the script I will use two loops, first loop foreach .admx in folder, second loop use for $index to assign values, I can do it right now.
Just foreach loop through filenames without extension, cast C:\Windows\PolicyDefinitions${filename}.admx to $xml1, and C:\Windows\PolicyDefinitions\en-US${filename}.adml to $xml2, use:
($xml2.policydefinitionresources.resources.stringtable.string | where {$_.id -eq $xml1.policydefinitions.policies.policy[$i].name})."#text"
To get display names, it is really simple. But the key does not contain the hivename (i.e. HKEY_LOCAL_MACHINE).
I have worked out this:
$xml.policydefinitions.categories.category.parentcategory.ref + $xml.policydefinitions.categories.category.name
To get path of GPO, I assume if it starts with Windows: then the key is stored in HKEY_LOCAL_MACHINE.

Is it possible to extract metadata such as Content Created date from files - I can't get this with PowerShell

I need to extract the "Content Created" date out of thousands of files, but haven't been able to find a way to do this using PowerShell / other Command Line utility.
Does someone out there know a way to obtain this metadata? If so, please can you advise me. Thanks.
I've looked at various resources online, including this site, but haven't been successful thus far.
Here's a screenshot explaining what I'm trying to do.
I've been unable to find a native powershell cmdlet which does what you want. However, I found this article: Use PowerShell to Find Metadata from Photograph Files and the script it used: get file meta data function.
The article talks about image files, but the function is not specific for image files.
I tested it out on a folder containing a Word and an Excel file and the returned Metadata from the Word file contains the Content Created date. The Excel file does not contain/return that value. This is not unexpected as the Details tab of properties for the Excel file does not contain a Content Created value so it seems to be specific for Word files, and maybe some other file or document types.
Update:
You write that you need to extract this info from thousands of files, but if those files are anything but Word-files you probably won't be able to do that.
As far as I can tell this should work with the file types exposing the type of metadata you want. However, it seems that the ContentCreated property is unique to Word. I tried adding a text file (.txt), Acrobat PDF (.pdf), MS Access (.mdb), Excel (.xlxs) and a Word doc (.docx) file to my test folder and the only one that has/returns that metadata property is the Word file.
You should also be aware that the script seems to return metadata localized, so for me to programatically get the info i wanted I had to pipe the output of the script to Select-Object -Property Name,'Innehåll skapat' (which is the Swedish name for Content created). So if you're running on a non-english system you may need to check what the output looks like before creating your Select-Object statement.
PowerQuery in Excel 2013 or later (data tab). Connect to data> Folder.

Can we change any file type using variable substitution rather than just JSON or XML

I want to change a js file and html file using release pipeline in VSTS. What I see is VSTS only allows JSON and XML config file transformation but I want to change other types(formats eg: .cs, .js, .ts, etc) of file as well.
Earlier we were using octopus deploy which has the option to transform these files.
Please let know if you know some other way to change the file in pipeline itself..
Can we change any file type using variable substitution rather than just JSON or XML
You could use Replace tokens from the Marketplace:
https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens
to change other types files.
You define the desired values as variables in the Release Definition and then you add the Replace Tokens task and configure a wildcard path for all target text files in your repository where you want to replace values. The token that gets replaced has configurable prefix and postfix (default are #{ and }#).
So, the format of variable in those files are #{TestVar}#.
Check my other thread for some more details.
Update:
We do not want to use third party tools from marketplace, do we have
any way within the scope of existing microsoft tools.
I am afraid there is no such directly existing Microsoft tools to change other types files at this moment, you could develop your powershell scripts to replace file content.
Check this thread for some more details.
Hope this helps.

Unix file associations of mime-type with multiple extensions

Unix File Associations is a welcome new feature in install4j 8.
I'm trying to register multiple file extensions as file associations with the same mime-type with the install4j 8.0.1 Unix Shell Installer.
The "Create a File Association" action only seems to accept one file extension so I initially tried adding multiple of these actions with a different extension but the same mime-type. This seems valid, but when it translates into the actual installation of the application it appears that the mime-info XML files being made are named with the same mime-type and so all but one get overwritten. This leads to only one file extension being associated with the mime-type.
I've also tried various separators (space, comma, semi-colon) in the file extension field, but this just ends up as a single unlikely looking extension in the mime-info XML file!
(e.g.
<glob pattern="*.ext1,ext2" weight="60"/>
)
The mime-info XML format allows multiple <glob> elements, so the mime-info XML file could contain, e.g.
<glob pattern=".ext1" weight="60"/>
<glob pattern=".ext2" weight="60"/>
but I can't see a way to get to this from install4j8.
Is there a way?
As of 8.0.1, this is indeed not possible. In 8.0.2, you will be able to specify multiple extensions separated by commas. Please contact support#ej-technologies.com to get a build where this is already implemented.

in org-mode, how to specify name of exported file?

In org-mode, when I export to PDF or HTML, I'd like to specify the names of the resulting files. Ideally two separate names, one for the PDF, one for the HTML. Is this possible?
Chris's answer is out of date. There is now an EXPORT_FILE_NAME setting:
#+export_file_name: <filename>
If you put this at the start of your file (not in a subtree), it will name the entire file that when you export.
Edit: For newer versions of org-mode, see slondr's answer.
It doesn't look like you can specify a name for the exported file as a whole.
From the link, emphasis mine:
When exporting only a subtree, each of the previous keywords can be overriden locally by special node properties. These begin with ‘EXPORT_’, followed by the name of the keyword they supplant. For example, ‘DATE’ and ‘OPTIONS’ keywords become, respectively, ‘EXPORT_DATE’ and ‘EXPORT_OPTIONS’ properties. Subtree export also supports the self-explicit ‘EXPORT_FILE_NAME’ property [4].
[4] There is no buffer-wide equivalent for this property. The file name in this case is derived from the file associated to the buffer, if possible, or asked to the user otherwise.