topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 7:08 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: IDEA: Batch Editor for URL and LNK Properties  (Read 84625 times)

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
IDEA: Batch Editor for URL and LNK Properties
« on: October 22, 2018, 10:39 PM »
The links in this post are inactive.  The download link, and further information, have been added to the end of the post.



Requested software will search system for both .lnk & .url files and change/edit their specified properties in batch mode.

LNK PROPERTIES
Shortcut Tab
Target:
Start in:
Shortcut key:
Run: Normal window | Minimized | Maximized
Comment:

URL PROPERTIES
Web Document Tab
Shortcut Key
Change Icon > Look for icons in this file

I have tried the following, but they do not have all requested capabilities:

BatchShortcutEdit.application
Website: http://www.btonkinson.com/software.php
Does not work on URLs
Can not search, list, and select
Can change Comments
Can change window size

ShortcutsSearchAndReplace 1.6.11
Website: http://jacquelin.pot...andreplace/index.php
Does not work on URLs
Can search, list, and select
Not an intuitive UI

THANK YOU!!!!




Important Information
THE LINKS ABOVE NO LONGER WORK - KodeZwerg did attach a working download link in a further reply to this post, to to preserve it and make life easier, I have attached it here


Reply where download link was found: Here

Download at the bottom of this post

-Stephen (Kynlo)
« Last Edit: February 25, 2022, 01:30 PM by KynloStephen66515 »

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 9,778
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #1 on: October 22, 2018, 11:53 PM »
I know this doesn't solve the problem in its entirety for you, but it may be one step along the way:

If you have a tool that can batch edit the .LNK properties, then maybe Skwire's Earl will help you convert your .URL files to .LNK files.

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #2 on: October 23, 2018, 12:08 AM »
Requested software will search system for both .lnk & .url files and change/edit their specified properties in batch mode.
What you mean with batch mode?
A console application where you set parameter to do auto things?
A GUI with dropbox where you smash in all your .lnk .url files in?
A program that expose a given driveletter to search for all that files?

I could be able to do such, one thing i cant/missing experience -> edit hotkey
But idk in what kind of way a tool should convert those files.... i need more input.
My only thought would be, collect all files by searching drive/partition, when collect is completed present a edit window to manual modify files.
If needed with URL to LNK convert.

ConstanceJill

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 243
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #3 on: October 23, 2018, 08:47 AM »
Yeah, we'd need to know a little more about what OP is trying to do.

Maybe it can be automated with a batch file and Shortcut.exe from http://www.optimumx....nloads.html#Shortcut ?

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #4 on: October 23, 2018, 08:26 PM »
By "batch" I mean for the software to search a directory, create a list of url or lnk, and then edit one or more of the files in the list.  In other words, not have to open each url or lnk file separately, but process multiple files at a time.  Any more questions?

ConstanceJill

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 243
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #5 on: October 24, 2018, 06:07 AM »
Yes: do you think you'll need to use that several times with different options, or is it for a one time job?

If the latter, can you tell specifically what you want to change ? For example "change all shortcuts which are set to run minimized so they run in a normal window", or "replace « some_string » with « other_string » for all the shortcut that contain it in the target field" ?

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #6 on: October 24, 2018, 03:16 PM »
 :Thmbsup: @ConstanceJill

Batch means automatism, should all .URL .LNK files get same values ????
WHAT SHOULD BE AUTOMATED IN WICH WAY <- that would be interesting to know if someone want to automate things.
All targets get same values would end up in a mess.

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #7 on: October 24, 2018, 09:34 PM »

Thank you, everyone, for your interest and ideas!

Yes, I will need to use this software several times with different options.  What I would like to change for each of the files I had listed in my original post.  Again:

LNK FILES
Properties Context Menu
Shortcut Tab
Target:
Start in:
Shortcut key:
Run: Normal window | Minimized | Maximized
Comment:

URL FILES
Properties Context Menu
Web Document Tab
Shortcut Key
Change Icon > Look for icons in this file

Your example "change all shortcuts which are set to run minimized so that they run in a normal window” is a good one.

I would like software to edit multiple files so that I do NOT have to do it manually (i.e., right click on a single, individual file and make changes, save, and then right click on another single, individual file and make changes)

Attached is a screenshot of the ShortcutsSearchAndReplace 1.6.11 software that shows what I would like to see.  The attachment is both a jpg file and a pdf file – whatever your preference.  With the ShortcutsSearchAndReplace software, you can find, sort, and select lnk (shortcut) files.  You can also sort the columns that are listed.  However, you can NOT edit mutiple lnk (shortcut) files and you can NOT find, sort, and select url files.

If my use of the word “batch” is misleading, forget that I used it.  To restate, hopefully so that everyone can understand, I would like to find, sort, and select lnk files and url files and be able to easily edit the fields that I listed above.

Any more questions?
Screen Print .jpgIDEA: Batch Editor for URL and LNK Properties

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,190
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #8 on: October 24, 2018, 09:52 PM »
I guess what's throwing people off is that you want to alter several links to have the same value for a given property.  That's pretty much it, in a nutshell?  And not sure that you can do that for shortcut key; I mean you could, but Windows only recognizes one of them.

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #9 on: October 24, 2018, 10:10 PM »
Yes, that's it.  For example, change/edit all .lnk/shortcut files that open Normal to open Maximized.  I know that this can be done for individual shortcuts one-by-one because I have done it that way.  That is the long, time-consuming, not-so-smart way.  I was hoping for some software that would automate (yes,"batch") this process......

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #10 on: October 24, 2018, 10:32 PM »
I can do this one in a day or three if nobody gets to it sooner.   :Thmbsup:

ConstanceJill

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 243
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #11 on: October 25, 2018, 07:00 AM »
Alright, the following batch file should scan for all .lnk files in the folder where it's called from, and change them to run maximized, if they're currently set to run in a normal window (NOT if they're set to run minimized, however).

It requires shortcut.exe, to be downloaded from http://www.optimumx.com/downloads.html

@ECHO OFF
where shortcut.exe >NUL
IF ERRORLEVEL 1 GOTO error

for /f "delims=" %%# in ('dir /s /b *.lnk') do (
ECHO * Querying shortcut file : "%%#"
shortcut.exe /A:Q /F:"%%#" | findstr /C:"RunStyle=1" >NUL
IF NOT ERRORLEVEL 1 (
ECHO - This shortcut is set to run in a normal window.
ECHO Modifying it to run in maximized window mode.
shortcut /A:E /F:"%%#" /R:3
) ELSE (
ECHO - This shortcut is NOT set to run in a normal window, not touching it.
)
)
ECHO ---
GOTO end


:error
ECHO -----------------------------------------------------------------------------
ECHO ERROR :
ECHO.
ECHO It looks like shortcut.exe was not found.
ECHO You need to download it from http://www.optimumx.com/downloads.html#Shortcut ,
ECHO and place shortcut.exe either in the folder from where you'll call this batch,
ECHO or in a folder that's referenced in your PATH environment variable.
ECHO.
GOTO end

:end
ECHO Done, press any key to close this window.
PAUSE>NUL

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 11,190
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #12 on: October 25, 2018, 09:35 AM »
That's some serious batch file work there!  Takes me back a ways... excellent work!  :Thmbsup:

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #13 on: October 25, 2018, 11:21 AM »
AGREE!!  This is an excellent batch file!  Again, thanks to all for their interest and ideas!

More questions:

What changes would have to be made to this batch file to run from the root directory and include all sub-directories?

What changes would have to be made to this batch file to selectively find and replace text in the Start in: and Comment: fields?  (Maybe some kind of user screen input?)

Could this batch file be incorporated into an .exe file to allow a slick User Interface for the user to search, sort, and select .lnk files and then process/edit them?  (I’m thinking this .exe file would probably have to include the code from the shortcut.exe file.)

Finally, what about URL files?  Can they be included in the same software or would that be a separate program?

THANK YOU!!!!
« Last Edit: October 25, 2018, 11:26 AM by berkland »

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #14 on: October 25, 2018, 11:23 AM »
Correction:  Could this batch file be incorporated into an .exe file to allow a slick User Interface for the user to search, sort, and select .lnk files and then process/edit them?  (I’m thinking this .exe file would probably have to include the code from the shortcut.exe file.)

ConstanceJill

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 243
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #15 on: October 25, 2018, 03:03 PM »
What changes would have to be made to this batch file to run from the root directory and include all sub-directories?
That one is pretty simple, assuming that by "the root directory" you mean c:\, just replace:
dir /s /b *.lnk
with
dir /s /b c:\*.lnk

What changes would have to be made to this batch file to selectively find and replace text in the Start in: and Comment: fields?  (Maybe some kind of user screen input?)

Here's the syntax from shortcut.exe, which you can get by running it with no parameter:

Shortcut [Version 1.11]

Creates, modifies or queries Windows shell links (shortcuts)


The syntax of this command is:

shortcut /F:filename /A:C|E|Q [/T:target] [/P:parameters] [/W:workingdir]
         [/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description]

 /F:filename    : Specifies the .LNK shortcut file.
 /A:action      : Defines the action to take (C=Create, E=Edit or Q=Query).
 /T:target      : Defines the target path and file name the shortcut points to.
 /P:parameters  : Defines the command-line parameters to pass to the target.
 /W:working dir : Defines the working directory the target starts with.
 /R:run style   : Defines the window state (1=Normal, 3=Max, 7=Min).
 /I:icon,index  : Defines the icon and optional index (file.exe or file.exe,0).
 /H:hotkey      : Defines the hotkey, a numeric value of the keyboard shortcut.
 /D:description : Defines the description (or comment) for the shortcut.

 Notes:
 - Any argument that contains spaces must be enclosed in "double quotes".
 - If Query is specified (/A:Q), all arguments except /F: are ignored.
 - To find the numeric hotkey value, use Explorer to set a hotkey and then /A:Q
 - To prevent an environment variable from being expanded until the shortcut
   is launched, use the ^ carat escape character like this: ^%WINDIR^%

 Examples:
   /f:"%ALLUSERSPROFILE%\Start Menu\Programs\My App.lnk" /a:q
   /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:c /t:^%WINDIR^%\Notepad.exe /h:846
   /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:e /p:C:\Setup.log /r:3

 An argument of /? or -? displays this syntax and returns 1.
 A successful completion will return 0.


 Copyright 2000-2005 Marty List, www.OptimumX.com

and what it's output looks like when querying an existing shortcut:

[Mozilla Firefox.lnk]
TargetPath=C:\Program Files (x86)\Mozilla Firefox\firefox.exe
TargetPathExpanded=C:\Program Files (x86)\Mozilla Firefox\firefox.exe
Arguments=
ArgumentsExpanded=
WorkingDirectory=C:\Program Files\Mozilla Firefox
WorkingDirectoryExpanded=C:\Program Files\Mozilla Firefox
RunStyle=1
IconLocation=%ProgramFiles%\Mozilla Firefox\firefox.exe,0
IconLocationExpanded=C:\Program Files (x86)\Mozilla Firefox\firefox.exe,0
HotKey=0 (None)
Description=

The command completed successfully.

To explain, the current version of the batch :

  • lists all of the .lnk files (from where it is being called, including sub-directories due to the /s in the dir command)
  • for each element in that list, it :
    • uses shortcut.exe to query the file's properties
    • uses findstr to filter the output, looking for the characteristic we want to find in the files that we want to act on (here it was "RunStyle=1")
    • if the file does match that characteristic, it uses shortcut.exe again to perform the change that has been requested (here it was to set RunStyle to 3)

Could this batch file be incorporated into an .exe file to allow a slick User Interface for the user to search, sort, and select .lnk files and then process/edit them?  (I’m thinking this .exe file would probably have to include the code from the shortcut.exe file.)
Not in its current state as doesn't take any input: both the selection criteria and the action to be performed are "hardcoded" in the script.
It would need to be reworked to accept parameters (or ask the user to input them) for which characteristics the files to be modified need to exhibit, and what has to be changed in them, and then pass the adequate parameters to shortcut.exe
I'm not sure I'm up to the task, probably better to wait for one of the real programmers here to do their own thing ;)

Finally, what about URL files?  Can they be included in the same software or would that be a separate program?
Shortcut.exe doesn't handle them, they don't work the same as .LNK files and don't have the same set of capabilities (as far as I know they don't allow, for example, to choose if the browser's window will be a normal one, maximized or minimized).

By the way there seems to be a bug with shortcut.exe itself, as the TargetPath and TargetPathExpanded values that I showed in my example are incorrect: I have the 64 bits version of Firefox and it sits in "C:\Program Files\Mozilla Firefox", I don't know where those "(x86)" came from…

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #16 on: October 25, 2018, 03:22 PM »
By the way there seems to be a bug with shortcut.exe itself, as the TargetPath and TargetPathExpanded values that I showed in my example are incorrect: I have the 64 bits version of Firefox and it sits in "C:\Program Files\Mozilla Firefox", I don't know where those "(x86)" came from…
I did not tried that shortcut.exe but the problem you might have, shortcut.exe is 32bit so %ProgramFiles% expand to its (x86) Name for \Program Files\.

Ps: Those "Expanded" fields in your sample are just to entertain you, they do not exist in .lnk files, this is a shortcut.exe feature.
« Last Edit: October 25, 2018, 03:28 PM by KodeZwerg »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #17 on: October 25, 2018, 11:30 PM »
I started working on this, so here's a teaser screenshot:

2018-10-25_232937.pngIDEA: Batch Editor for URL and LNK Properties

Obviously early...but it'll get there.

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #18 on: October 28, 2018, 04:56 PM »
WOW!!!!

I continue to be impressed with the programming that you all do.

ConstanceJill, thank you for sending the batch file for making changes to shortcuts.  I don't know that much about programming, but I kind of figured out how it works.

skwire, I can hardly wait to see how the UI turns out.  Will we be able to sort the columns?  How will we be able to select a file?  I don't see any way to mark the files for selection.  Will we be able to select more than one file?

Thanks to all for their interest and ideas!

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #19 on: October 28, 2018, 05:37 PM »
Will we be able to sort the columns?

Yes.

How will we be able to select a file?

All the standard ways; drag-n-drop, file select dialog, etc.

I don't see any way to mark the files for selection.

The final will have checkboxes.  Again, that screenshot was early and represented about twenty minutes of work.

Will we be able to select more than one file?

Yes.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #20 on: November 04, 2018, 09:58 PM »
I've had some more time to work on this.  It's getting there:

2018-11-04_215701.pngIDEA: Batch Editor for URL and LNK Properties

I travel for work, and I've been traveling more than usual lately, so I haven't had as much time as I'd like to work on this.  Thank you for your patience.
« Last Edit: November 04, 2018, 10:05 PM by skwire »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #21 on: November 04, 2018, 11:33 PM »
Changed up the UI a bit:

2018-11-04_233245.pngIDEA: Batch Editor for URL and LNK Properties

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #22 on: November 05, 2018, 07:36 AM »
Looking good.
One way that some of these bulk operation tools work is with a checkbox also next to each field (name, target, arguments, start in, etc.) so that if you wanted to set the target for 10 shortcuts you'd checkbox the 10 shortcuts, then checkbox (only) the "target" field, and hit apply, and it would set the target for all items.  Just a thought.

berkland

  • Participant
  • Joined in 2018
  • *
  • default avatar
  • Posts: 34
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #23 on: November 05, 2018, 04:40 PM »
Again, I am VERY impressed. I really appreciate your taking time and effort to complete this project. And, believe me, I understand what traveling for work means. Please take your time (although I'm greatly anticipating the final product!). Thanks again.

KodeZwerg

  • Honorary Member
  • Joined in 2018
  • **
  • Posts: 718
    • View Profile
    • Donate to Member
Re: IDEA: Batch Editor for URL and LNK Properties
« Reply #24 on: November 06, 2018, 01:42 AM »
it misses Hotkey but looking nice  :up: