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 40,976 of 42,547    |
|    Todd to Todd    |
|    Re: How do I extract a value into a vari    |
|    06 Aug 14 22:35:50    |
   
   From: Todd@invalid.invalid   
      
   On 08/06/2014 06:49 PM, Todd wrote:   
   > Hi All,   
   >   
   > I need to extract a value into a variable.   
   >   
   >   
   > echo path=\abc\def\xyz | find /i "path"   
   > path=\abc\def\xyz   
   >   
   > What I need is to cut up the above and place   
   > "\abc\def\xyz" into a variable   
   >   
   > Many thanks,   
   > -T   
      
      
   Hi All,   
      
   Figured it out.   
      
   Is it just me, or does batch programming make you pull your   
   hair out!   
      
   AAAAAAAAAAAAAAAAAHHHHHHHHHHHHH!!!!!!! WHO NEEDS HAIR!   
      
   Someday I am going to have to break down and learn Perl.   
      
      
   -T   
      
   How to extract a segment of a line from a file into a variable:   
      
      
   File (profiles.ini):   
      
   [General]   
   StartWithLastProfile=1   
      
   [Profile0]   
   Name=default   
   IsRelative=1   
   Path=Profiles/syx22zx0.default   
      
      
      
      
   To extract "syx22zx0.default"   
   set Profile=%AppData%\Thunderbird\profiles.ini   
      
   for /f "tokens=1,2,3 delims=^=/" %a in ('type "%Profile%" ^| find /i   
   "path"') do set   
   SentPath=%AppData%\Thunderbird\Profiles\%c\Mail\pop.secureserver.net\Sent   
      
      
      
   C:\NtUtil>dir "%SentPath%"   
    Volume in drive C has no label.   
    Volume Serial Number is 882D-E570   
      
    Directory of   
   C:\Users\RSA\AppData\Roaming\Thunderbird\Profiles\syx22zx0.default   
   \Mail\pop.secureserver.net   
      
   08/06/2014 05:19 PM 38,882,248 Sent   
    1 File(s) 38,882,248 bytes   
    0 Dir(s) 174,087,081,984 bytes free   
      
      
   Note: use two %% around for variables in a batch file   
      
   --- 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