Jump to content
Ketarin forum

Tip: Working around & in commands


shawn
 Share

Recommended Posts

I've been logging my updates to a text file in the "after updating an application" command for something close to as long as I've been using Ketarin. One of my continued issues is that any command that included an ampersand (&) didn't actually take effect. And it's a security risk.

 

I had no idea that the shell had an escape code for ampersands, but I discovered one just tonight and was able to use it in my commands to bypass this problem. YAY!

 

The escape character is a caret (^), and can be used as so:

 

echo {category:replace:&:^&} - {appname:replace:&:^&} {version:replace:&:^&}>updates.txt

Link to comment
Share on other sites

  • 1 month later...

This is awesome.I made a customized version that appends all changelogs to the changelog:

echo {f:dd}.{f:MM}.{f:yyyy} : {appname:replace:&:^&} updated to v.{prettyversion:replace:&:^&} - {changelog:replace:&:^&}>>CHANGELOG.txt

 

And after updating all apps add a small separator and open the file on top at the last line:

echo ---------------------------------------------->>CHANGELOG.txt
"%ProgramFiles(x86)%\Notepad++\notepad++.exe" -alwaysOnTop -n99999 "{Apps x86p}\Ketarin\CHANGELOG.txt"

 

Changelog output looks something like this:

15.02.2011 : [searchLoad Options] updated to v.0.6.3 - Added sv-SE translation.

16.02.2011 : [Text Link] updated to v.4.0.2011021601 - Fixed: Migration of preferences was failed if user had custom values.

23.02.2009 : [search on Engine Change] updated to v.1.2 - compatible to Scroll Search Engines (the search is only executed if the active search engine isn't changed within 300ms)

18.11.2009 : [Organize Status Bar] updated to v.0.6.4 - Changed maxversion from 3.6a1pre to 3.6.*

----------------------------------------------

16.09.2011 : [CheckPlaces] updated to v.2.6.1 - Fixed minor bug when reporting errors

23.08.2011 : [About-Telemetry] updated to v.0.6 - Now with Thunderbird support. Thanks protz!

14.04.2011 : [About-Startup] updated to v.0.1.5 - The about:startup page wasn't displaying any data right after installation until a restart.

11.06.2010 : [bBCodeXtra] updated to v.0.3.2 - Fixed "color " command, added back "he" locale.

----------------------------------------------

 

If i could only figure out how to open the file after all app updates ONLY if something was written there.If no updates then no separator added there and no opening it either.Any ideas on this?

Link to comment
Share on other sites

If the log file is only generated after 'all updates are completed' then just add an extra line so that if something gets written an extra file gets created as well

 

Then just

 

if exist change.txt c:\program.exe

del change.txt

 

Should be the easiest solution

 

As to detect for 'appending' couldn't you just dump two files into a variable then compare them?

 

for /f "tokens=*" %a in ('type log.txt') do set log=%a

for /f "tokens=*" %a in ('type {changelog}') do set change=%a

 

if "%log%" EQU "%change%" exit

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.