A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Windows 10 » Windows 10 Help Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

What syntax combines 2 commands into a single shortcut TARGET line?



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old August 29th 19, 06:04 PM posted to alt.comp.os.windows-10,alt.msdos.batch,comp.os.msdos.programmer,alt.comp.freeware
B. R. 'BeAr' Ederson
external usenet poster
 
Posts: 8
Default What syntax combines 2 commands into a single shortcut TARGET line?

On Thu, 29 Aug 2019 01:25:06 -0000 (UTC), AG Holder wrote:

What syntax combines 2 commands inside a single Windows shortcut TARGET?


None. A shortcut isn't a shell, but a defined structure to information
resolvable as a command string to a *single program* with parameters:

[NAME_STRING] [RELATIVE_PATH] [WORKING_DIR] [COMMAND_LINE_ARGUMENTS] [ICON_LOCATION]

or to a *single document*, which hopefully has a standard action/program
assigned to its file type.

Here's the current file format reference:

https://winprotocoldoc.blob.core.win...es/MS-SHLLINK/[MS-SHLLINK].pdf

As long as you do not wish to link to script files, which of course could
execute several commands, your only other option would be to link to a
launcher program, that is able to execute several commands listed as its
command line arguments.

You can use the cmd shell as such a launcher, e.g.:

cmd.exe /c notepad C:\Temp\1.txt && notepad C:\Temp\2.txt
cmd.exe /c notepad C:\Temp\1.txt & notepad C:\Temp\2.txt
cmd.exe /c start notepad C:\Temp\1.txt & notepad C:\Temp\2.txt

The first version starts the second command only if the first command
succeeded successfully. The second version starts the second command
when the first completed (successful or not). The third version starts
the second command directly after starting the first (while the first
is still running).

BeAr
--
================================================== =========================
= What do you mean with: "Perfection is always an illusion"? =
================================================== =============--(Oops!)===
Ads
  #2  
Old August 29th 19, 07:18 PM posted to alt.comp.os.windows-10,alt.msdos.batch,comp.os.msdos.programmer,alt.comp.freeware
AG Holder
external usenet poster
 
Posts: 12
Default What syntax combines 2 commands into a single shortcut TARGET line?

On Thu, 29 Aug 2019 19:04:39 +0200, B. R. 'BeAr' Ederson wrote:

None. A shortcut isn't a shell, but a defined structure to information
resolvable as a command string to a *single program* with parameters:


Hi Bear,

We go way back, over the years, where you're always purposefully helpful.

Hence thanks for your purposefully helpful added value to the Potluck.
o Linking to a launcher is EXACTLY what we did to SOLVE the stated problem.

Bear in mind, it's extremely useful, particularly for encrypted file
containers, to be able to mount and unmount ALL of them, instantly.

As long as you do not wish to link to script files, which of course could
execute several commands, your only other option would be to link to a
launcher program, that is able to execute several commands listed as its
command line arguments.


The goal, always, is efficiency & part of efficiency is portability, where
NOT having to create, maintain, and port batch files is useful.

Also, having a shortcut on the taskbar that doesn't require anything else
to run, or having a Start Run command in the registry that also doesn't
require anything else to run - is useful - particularly given the goal is
efficiently quick mounting and dismounting of ALL encrypted file containers
in a single operation.

You can use the cmd shell as such a launcher, e.g.:

cmd.exe /c notepad C:\Temp\1.txt && notepad C:\Temp\2.txt
cmd.exe /c notepad C:\Temp\1.txt & notepad C:\Temp\2.txt
cmd.exe /c start notepad C:\Temp\1.txt & notepad C:\Temp\2.txt

The first version starts the second command only if the first command
succeeded successfully. The second version starts the second command
when the first completed (successful or not). The third version starts
the second command directly after starting the first (while the first
is still running).


Yup. Thanks for your purposefully helpful on-topic suggestion, which is the
only one known to man that fits the stated problem set (AFAIK).

I figured what you already knew out after Grant kindly told me to stop
wasting time trying to get the ampersand syntax to work in the TARGET all
by itself.

Then, when I looked up the old "grep" rolodex command tutorial we created,
and when I then saw the old "open the admin command window with big fonts &
a red background" tutorials from years ago that we wrote, I instantly
remembered and realized we used the compec with an added switch whenever we
found that we couldn't nest commands in the Windows shortcut TARGET line:

That is, this failed in the shortcut TARGET line:
o cmd1 & cmd2

This worked in the shortcut TARGET line:
o %comspec% /k cmd1 & cmd2
o %comspec% /c cmd1 & cmd2

Where the commands could have been anything, e.g.,
o TARGET = %comspec% /k date /T sys.txt & ipconfig /all sys.txt & route print sys.txt & netsh int ip show route sys.txt & systeminfo sys.txt & net start sys.txt & dir /s/a/l/on/b C:\ *.* sys.txt

But where, in this situation of mounting encrypted file containers, it was:
o TARGET = %comspec% /k VeraCrypt /volume X.hc /letter X /auto /quit /explore & VeraCrypt /volume Y.hc /letter Y /auto /quit /explore

NOTE: The Truecrypt "beep" switch doesn't seem to work with Veracrypt.
%comspec% /k Truecrypt /volume X.tc /letter X /auto /quit /explore /beep & Truecrypt /volume Y.tc /letter Y /auto /quit /explore /beep

NOTE: The Veracrypt applications has switches to unmount all containers:
o TARGET = VeraCrypt /dismount /force

In summary, this problem set has been SOLVED - thanks to you & Grant.

Over the years, we've all grown to know who brings purposefully helpful
added value to the Usenet potluck, where I appreciate your post, and that
from Grant Taylor, both of which were adult purposefully helpful posts
which brought value to share with the interested Windows community, such
that we can now easily mount and dismount all the encrypted file containers
with an efficient single TARGET line of nested Veracrypt/Truecrypt
commands.

--
I will not respond further to the worthless child-like trolls Rudy Wieser
and Mayayana, both of whom not only posted dead wrong information, but
neither of whom had any intent of purposefully adding adult value.
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 09:02 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.