editlinks.vbs (week #25)

Wednesday, June 19, 2013 Labels: ,
This utility modifies specified shortcut (.lnk) file's paths, including the target, directory, icon, and sometimes description.

There is no usage information provided by the script itself, so here it is:

USAGE:
  editlinks.vbs [/s] [--path C:\path] "replace" "with" ["replace" "with"] ...

This will update all paths:
  • Target — the application linked to
  • Start in — the starting directory
  • Icon — the location of the icon
It will also empty the description property/field if it matches (exactly) the Target.

Here is an example:

    $ editlinks.vbs --path "C:\new-bin" "C:\old-bin" "C:\new-bin"

This will change all shortcuts that point to 'C:\old-bin' to point instead to 'C:\new-bin'.

NOTE: When retrieving the TargetPath from a shortcut, it will (sometimes?) expand any environment variables already in it. This will cause the number of changed files to seem quite large (and never go down).

Check out the source code at GitHub!

attr.exe (week #24)

Tuesday, June 11, 2013 Labels: ,
A simple utility to view and modify file attributes.. There are three main benefits of this utility over Windows' built-in attrib.exe.
  • The order in which you alter the attributes does not matter. For instance, you don't have to explicitly remove -r before -s, etc.
  • You can combine attributes as in: `attr -rsh file`.
  • You can modify multiple files via the same command-line as in: `attr -sa file1 file2 +hs file3`.
Here are the details:

USAGE: attr.exe [options] [file] [file..n] [options file..n] ...

  no-arguments    Displays attributes for all files (and
                  directories) in the current directory.

  file            Specifies a file (or file wildcard) for attr 
                  to process.

OPTIONS:

    +     Sets an attribute.
    -     Clears an attribute.

    r     Read-only file attribute.
    a     Archive file attribute.
    s     System file attribute.
    h     Hidden file attribute.

  /p --pause      Pause when finished.
  /r --recursive  Processes matching files in the current 
                  directory and all sub-directories. (also /s)
  /d              Processes directories as well.
                  (sorry this isn't implemented yet!)

     --showpath   Output each file's full path and name.
                  Default is file name only (without the path).
EXAMPLES:

  $ attr -h -s desktop.ini
    Removes the hidden and system attributes from desktop.ini.

  $ attr -hs +a desktop.ini
    Removes the hidden and system attributes from
    and adds the archive attribute to desktop.ini.

  $ attr -r +hs -a desktop.ini +hs folder.jpg
    Removes the readonly and archive attributes from and adds the
    hidden and system attributes to desktop.ini.
    Removes the archive attribute and adds the hidden and system
    attributes to folder.jpg.

  $ attr /s -h -s desktop.ini
    Removes the hidden and system attributes from desktop.ini in
    the current and all sub-directories.

Check out the source code at GitHub!

createpw.exe (week #23)

Tuesday, June 4, 2013 Labels: ,
This is a simple utility to create unique passwords from a key (such as a website name) and a master password. The idea for the code came from ss64.com.

USAGE: createpw.exe [options] [key|site-name]

  key|site-name      Any unique key that you will remember.
                     If you’re using this for a website, put in
                     the url (such as: amazon or amazon.com).
                     If omitted, you will be prompted for it.

OPTIONS: 

  --clip             Put the newly created password onto the clipboard. 
                     This is the default behavior.
  --no-clip          Output the new password to the console.
  --no-symbols       Do not output symbols in the new password.

When it asks for the user name, you can just press enter to bypass/skip it. JUST be sure that you are consistent in supplying a user name with keys or not.

Here are a couple of examples:

    $ createpw amazon.com
    Enter the username:         user
    Enter the master password:  ********

    password = (put into clipboard)

    $ createpw
    Enter the site name or key: amazon.com
    Enter the username:         user
    Enter the master password:  ********

    password = (put into clipboard)

    $ createpw --no-clip
    Enter the site name or key: amazon.com
    Enter the username:         user
    Enter the master password:  ********

    password = #ZJ~EEUmXuYVdMEMUK7CVbgxqY

For the last example I typed `12345678` for the password. You should get the same result!

Check out the source code at GitHub!
Older Posts Home Newer Posts