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 TARGETline?



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old August 29th 19, 03:17 AM posted to alt.comp.os.windows-10,alt.msdos.batch,comp.os.msdos.programmer,alt.comp.freeware
Grant Taylor
external usenet poster
 
Posts: 7
Default What syntax combines 2 commands into a single shortcut TARGETline?

On 8/28/19 7:25 PM, AG Holder wrote:
What syntax combines 2 commands inside a single Windows shortcut TARGET?


I'm not aware of any single command syntax that can do that.

Put the multiple commands in a batch (or command) file and make it the
target of the shortcut.



--
Grant. . . .
unix || die
Ads
  #2  
Old August 29th 19, 04:50 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 Wed, 28 Aug 2019 20:17:01 -0600, Grant Taylor wrote:

I'm not aware of any single command syntax that can do that.


Hi Grant Taylor,

Usenet is a potluck where everyone brings what value they can to share.

Hence, I thank for that information, as there is usually a trick that an
expert knows for almost any efficiency maneuver (such as the trick to use
"control + shift" along with "enter" in a run command to be administrator).
a. Usually there's a syntax available in the command interpreter
b. Often there's a command available in the program (i.e., Veracrypt)
c. Sometimes another command can be substituted (e.g.,

For example, combining commands works fine in the DOS shell, e.g.,
o C:\ cmd1 & cmd2 (execute them in sequence)
o C:\ cmd1 && cmd2 (execute after evaluating errorlevel 0,1)
o C:\ cmd1 | cmd2 (redirect the first into the second)
o C:\ cmd1 || cmd2 (redirect only after evaluating errorlevel 1,0)
o C:\ cmd1 foo.txt 2&1 (make use of the stdout error file)

But they don't seem to work inside the TARGET line of a shortcut.
But there must be a way to add multiple commands to a single TARGET line.

Almost always, what people "think" doesn't exist (e.g., WinXP menus on
Win10) are already there - native - (e.g., the curl command is in Windows
10 and almost nobody knows about it).

There's ALWAYS a way to do anything we want to do in a batch file, e.g.,
how we added the red color to just our Windows Admin command prompts:
https://groups.google.com/d/msg/microsoft.public.windowsxp.general/ySVGbayhLSk/khw_ulyZBAAJ

Or like how we created a "grep" of our phone rolodex files
https://groups.google.com/d/msg/microsoft.public.windowsxp.general/ySVGbayhLSk/N-IqUQPiAwAJ

But the goal here is clearly to put the efficiency commands into a single
line of a shortcut TARGET, and that's it, where we can use some sort of
Windows expert knowledge, such as how we utilized the AppPaths key to
create an efficient "vipw" command without editing anything but the
registry.
https://groups.google.com/d/msg/microsoft.public.windowsxp.general/ySVGbayhLSk/8EMXRgb5AwAJ

The point is that, almost always, Windows experts can find Windows tricks
(such as the AppPaths command) that make almost ANY command possible with
efficiency (sans mucking with the path) - as we found with the AppPaths key
for "hosts" which opens the extensionless hosts file in a single cmd into
your default editor.

As you seem to be astutely aware (unlike the troll, Rudy Wieser who has
never posted anything above his fifth-grade education level in his entire
life) this is a similar Windows-expert efficiency question, where the
always sophomoric response by Rudy of pointing to a batch file was NEVER
the goal (which you intelligently ascertained immediately).

Still ... there must be a way - as there is _always_ a way to efficiency.

I will continue to seek the desired efficiency, where I explored these
o TARGET = cmd1 & cmd2 (execute them in sequence)
o TARGET = cmd1 && cmd2 (execute after evaluating errorlevel 0,1)
o TARGET = cmd1 | cmd2 (redirect the first into the second)
o TARGET = cmd1 || cmd2 (redirect only after evaluating errorlevel 1,0)
o TARGET = cmd1 foo.txt 2&1 (make use of the stdout error file)
etc.

But I still have more ideas to test out before we give up (which we almost
never have to do, since we can almost always find an efficientway to do
everything that we do frequently - without having to resort to the crutch
of batch files.
  #3  
Old August 29th 19, 05:24 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 15:50:27 -0000 (UTC), AG Holder wrote:

I will continue to seek the desired efficiency, where I explored these
o TARGET = cmd1 & cmd2 (execute them in sequence)


Hi Grant Taylor,

SOLVED!

Once I followed your helpful suggestion to give up on wasting time trying
to get the the ampersand syntax to work with the app directly in the TARGET
line, I then immediately figured out a way to incorporate the ampersand
into the TARGET line anyway, which was to utilize the same technique we
used in the past to combine commands to create a rolodex grep using nothing
more than a simple call to a registry key.

This is the simple solution (so far):
o Calling the application directly doesn't allow the ampersand to work
o But calling the app via the comspec _does_ allow the ampersand to work

That is, this doesn't work:
o TARGET = cmd1 & cmd2
But this does work!
o TARGET = %compspec% /k cmd1 & cmd2

I should have remembered this, but my memory was tweaked by my last
response, where we've solved so many Windows problems that we forget all
the tricks - where the trick was that I had already used (long ago) this
comspec /k concept to create a shortcut which spits out system snapshot
information into a file, where, from memory, the TARGET line was something
like the following that I just hacked out for this post:

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

That same technique, which I had forgotten we used long ago to create
system snapshots, worked fine with Veracrypt just now:

TARGET = %comspec% /k veracrypt.exe [PUT THE FIRST MOUNT HERE] & [PUT THE SECOND MOUNT HERE]

Now we have efficient shortcuts which mount & dismount ALL encrypted
volumes in a single TARGET line.

TARGET = veracrypt.exe /dismount /force
TARGET = %comspec% /k veracrypt.exe /volume C:\tmp\X.hc /letter X /auto /quit /explore & veracrypt.exe /volume C:\tmp\Y.hc /letter Y /auto /quit /explore

In summary, the simple trick was to NOT use the application commands
directly in the shortcut TARGET, but to use the /k comspec switch first,
and _then_ combine the two application commands.

This concept of adding the ampersand to the shortcut TARGET line, of
course, will have general use in the future, so it's great that we were
able to add value to the Usenet potluck to share with the other team
members who care to learn how to be extremely efficient on Windows.
 




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 03:35 PM.


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