home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,755 of 42,547   
   AG Holder to AG Holder   
   Re: What syntax combines 2 commands into   
   29 Aug 19 16:24:14   
   
   XPost: alt.comp.os.windows-10, comp.os.msdos.programmer, alt.comp.freeware   
   From: a.g.holder@holder.net   
      
   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.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca