Is a Batch file what I need? [closed] - windows

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to create a script that will set the file associations for mostly MS Office files and a few other files extensions to the local applications (they would currently be through citrix). I am planning on using a simple Batch file.
However I would like it to be able to detect whether the filetype is valid and create it if not using ftype. I would also like it to be able to detect/differentiate between whether the user has MS Office 2003 or MS Office 2007 and associate accordingly.
My question is, will a Batch file be able to do all this, or am I better off using something else like a vb script (taking into account I know NO vb, although I'm pretty novice with Batch files too)??
Any help is appreciated
EDIT: I should have bee clearer that this is in a locked down environment, so no direct registry editoring can be done, and it will need to be available to users, from a shared drive or something similiar.

A batch file alone can't detect if the file association is correct, but you could just fire the batch file everytime anyway, forcing the file association to be correct. It'll just overwrite what's already there.
Just create the proper associations yourself, then run Regedit and export a .reg file containing the association keys, and use a batch file that runs regedit to import the keys. Probably /import or somesuch - I rarely use Windows anymore!
Here's a page that explains it:
http://www.robvanderwoude.com/regedit.php

You can use Powershell scripts. You get the power of .NET, a very good scripting language and you can effectively do anything you can with vbscripts and bat files. You also have a very vibrant community. And Powershell makes operating with registry so easy and intuitive that you will not know the difference between operating on files and operating on registry items

Related

How to detect unnecessary Windows\Installer file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
i have search a lot to find out How to detect unnecessary Windows\Installer file !
I am sure lot of you have faced this issue previously and solve it somehow.
Now when i look at my ---
C:\Windows\Installer
directory on Windows Server 2008 R2 i can see it took already 42 GB out if total 126 GB.
Now what i would like to know can i just delete all the files from that Installer directory or i have to detect which file can be removed !
Do anyone knows any solution for this issue !
How do you define unnecessary?
Specialized system case: You want the minimum footprint and are willing to sacrifice functionality that you don't expect to use.
If all is well, each the files in C:\Windows\Installer are a local cache of an installed Windows Installer package, patch, transform, etc. They are necessary for uninstallation, auto-repair or on-demand installation to succeed. If you will never need any of those things on these machines (i.e. if you are bringing them up on demand as VMs, and would rebuild them rather than uninstall something), then unless the app itself invokes Windows Installer APIs itself, it may be relatively safe to remove files from C:\Windows\Installer. In addition, you could call the Windows Installer API MsiSourceListEnum to find other caches of files that are used for these same purposes. It may be similarly safe (or unsafe) to remove those files.
More usual case: You'd rather not rebuild the system
If you suspect there are unreferenced files in that folder left over from prior upgrades or uninstallations, you can try to use Windows Intstaller API calls to verify this. At a very low level, you can call MsiEnumProducts (or possibly MsiEnumProductsEx) to find the product codes of all installed products, and MsiGetProductInfo/Ex(szProduct, INSTALLPROPERTY_LOCALPACKAGE, ...) to find its cached .msi file and INSTALLPROPERTY_TRANSFORMS for a list of its transforms. Then MsiEnumPatches/Ex to find all patch codes and MsiGetPatchInfo/Ex (again with INSTALLPROPERTY_LOCALPACKAGE and/or INSTALLPROPERTY_TRANSFORMS) to list the .msp and .mst files it references. In theory, the full set of all files referenced here should match up with the full set of files in C:\Windows\Installer. (Or there are more references to look for...)
(Before you write anything to do this, consider that there are probably apps out there that automate this, or are even smarter about it, such as the one referenced in another answer.)
You could not delete them all.
There is a good answer about your problem, I test in my lab. It works for me.
Notes: If possible, you had better copy this folder to anther disk (such as E:)

Any tool to convert bulk php files to UTF-8 without BOM? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have a very large script which contains a lot of php files, so I need some Windows tool to convert all those files into UTF-8 without BOM. (I know this can be done with Notepad++ but would require doing each file separately.)
I have used with success UTFCast on Windows.
It has a GUI, and is very easy to use, so you don't have to fiddle with command line scripts.
There's an "Express" free version that can do what you want, and a Pro version with more options (has a 14 day trial).
You can see here a comparison chart of both versions, to see if it suits your needs.
Express detects less codepages, but for me its worst defect is that has no filter, for only process PHP files and not JS for example.
The Pro version beyond the 14 days can be used to browse folders and detect encoding of files, but not to convert.
Actually, I do it with Notepad++.
Before trying this, you must make a backup of your files.
You need to create a macro that does this:
Convert the currently opened file to UTF-8 w/o BOM;
Select all the text in your file, and copy it (why this? it looks like a bug. if you won't do this, your file will be replaced with your current clipboard content...);
Save the current file;
Close the current file.
Save this macro.
Now, open your PHP files, and run it with the "Run a Macro Multiple Times..." command.
If you opened 100 files, let it run for 100 times.
You can get a tool such as iconv from GnuWin32 and run a batch script to process all of your files that way.
But what encoding are they now? If they're ANSI, and you're not using any bytes with values => 128, then they're already BOM-less UTF-8. Perhaps you can use that to narrow down the number of files you'd have to process - maybe enough that you only have a few files to convert (and might prefer to do it on an individual basis).
At the bottom of this page you’ll find a VBscript which converts any number of files per drag and drop.

Editing .resx files on a Mac [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 24 days ago.
Improve this question
Is there any app that I can use to edit .resx files on a Mac running OSX?
I just need to be able to edit string resources.
Edit. I know .resx files are XML files. However, I am looking for an app that can edit .resx files using a clean user interface, very much like Visual Studio does, hiding the complexity of the XML. I don't want users to be able to accidentally modify the XML structure.
As far as I'm aware, not directly. However, .resx files are XML, so you if you're comfortable with their syntax, open them in your favorite plain-text editor (XCode, BBEdit, whatever) and hack away.
Edit based on the update to the question
Nothing, as far as my Google-fu can find, currently exists to fill this need. However, .resx files are relatively straightforward XML, so if you have a Mac and XCode, you can probably whip up something with an NSTableView that operates similarly to Visual Studio's in-box .resx editor for strings.
Now, it's considerably less trivial to support other resource formats (particularly binary data), but strings at least shouldn't be terribly complicated.
I wish I could give you a "proper" answer, but unfortunately, I simply cannot locate anything appropriate. I see many .resx editors out on the web, but all are for Windows. To get you started building something (I know this wasn't your intent, but it's likely your only answer), check these APIs:
Mac XML APIs, courtesy of Apple's Developer site.
NSTableView class reference
NSTableViewDataSource class reference
If building something is truly not viable, your other option is to either virtualize Windows (using VMWare Fusion or Parallels Desktop), or to use Boot Camp and create a Windows partition. Then you can install any of the zillion and one .resx editors for Windows -- or even a Visual Studio Express instance, which will also contain .resx editing in-box.
There is now a macOS app for editing regex files in the App Store.
https://apps.apple.com/us/app/resx-editor/id1484612171?mt=12
I've just started using it, so I can't offer much of a review, but it does seem to work fine so far, and at that price, I figured it was worth checking out.
The best App is ResX Editor, it is for Mac user.
It do the job like a charm! this is worth it for 2$!
You can get it for free on source forge
If you are still looking for an option for your mac, I used an extension (free) for VisualStudio Code called ResXpress: https://marketplace.visualstudio.com/items?itemName=PrateekMahendrakar.resxpress

Can you recommend a good SSH syncing utility? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Can you recommend a good SSH file sync utility for Windows? For example, I have some C++ sources that I need to compile remotely. I need this utility to be simple and most of all responsive, so I can compile my sources instantly after saving, without having to wait for the sync to be triggered.
WinSCP supports synchronization from both gui and command line.
Use rsync. See this. There is even an instruction to set automatic backup.
for source-code, you could use something like git or subversion, paired with an ssh-connection using port-forwarding.
in all cases you would need to trigger the sync yourself except you have a tool that watches the directory you're working on.
try this, SSHSync for windows
http://code.google.com/p/sshsync/
A command line applications that allows intelligent Secure FTP transmissions. SshSync only support pull type transfers, but it allows use of a Private Key to ensure that authentication is secure. A text file that contains a list of files always processed is used to check that only 'new' files are retrieved.
Sounds like a job for a Continuous Integration tool.
install cygwin and use rsync over ssh.
It seems to me that one way to solve your problem would be to simply use a network drive. Edit your files from the network drive, and whenever you save, any other systems connected to that drive can also access your changes, including your build server. That's what we do at my office — everyone's home directories are on NFS/CIFS shares, so we edit on our local computers, but run a script to trigger a build on any of several build servers, even multiple platforms at once. We don't have to sync anything before being allowed to compile our latest changes.

How would you programmatically test a file for viruses? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I want to programmatically test a file for viruses.
I'm aware of this thread, which didn't get a satisfactory answer in my opinion, but I'm not looking for an API here. Any kind of workaround to make it possible to test a file would be fine.
Of course, an API would probably be the best solution (I'm using .net on a Windows platform), but maybe it's possible to drop the file in the folder, and to then check whether I can still open it or if it's been quarantined by the antivirus software.
Has someone run into the same sort of situation?
Assuming you wish to integrate with whatever antivirus is already present on the system rather than bundling your own, you should check out the way Firefox 3 does this.
Bugs 103487
and 408153
- Inform anti-virus software when Firefox downloads an executable (using
the Windows "IOfficeAntiVirus" and
"IAttachmentExecute" APIs).
(of course if you wish to bundle your own, check out ClamAV/ClamWin, but then you must deal with updates, etc, and you should probably first check there is not a fully updated solution on the target system for politeness)
Windows? No problem. Check out ClamWin. It is based on ClamAV.
Platform?
Most Windows anti-virus provide shell integration (right click on a file in explorer to scan that file), which will either mean running an executable, DDE or COM. All of which provide an entry point to another program to call the same mechanism.
Check out ClamAV.
Clam AntiVirus is an open source (GPL) anti-virus toolkit for UNIX, designed especially for e-mail scanning on mail gateways.
Maybe you could use this web service, assuming the file is less than 1MB:
http://www.kaspersky.com/scanforvirus
If you discover a suspicious file on
your machine, or suspect that a
program you downloaded from the
Internet might be malicious, you can
check the files here.
Indicate the file to be checked; it
will automatically be uploaded from
your computer to a dedicated server,
where it will be scanned using
Kaspersky Anti-Virus. Multiple
independent tests and publications
acknowledge the solution to have
exceptional detection rates. Updates
every three hours ensure that even the
very newest viruses can be detected.
Only one file of up to 1 MB can be
checked at any one time. If the file
is too large, a window with an error
message will be displayed. Type the
name of the file in the window at the
top of this page, or find the file
using 'Browse'. Then click on
'Submit'.
You can use a Debugger or a Disassembler
It really depends on which AV program you're going to use. Read the documentation for whatever solution you choose and you'll probably find a command-line interface or some other API you can call. There's no "generic" way of doing this (across AVs).

Resources