Prev: User Accounts
Next: Autostart
From: nkhimani on 6 Sep 2005 11:20 Folks, I need help ... in UNIX world it is relatively easy to set a variable from a process. For example: $ junk=`ls -altr | tail -1 | awk '{print $9}'` $ echo ${junk} This sets variable 'junk' to the file name of most recent file. What's the trick to perform this in DOS world? TIA, -NK
From: Jim on 6 Sep 2005 11:58 <nkhimani(a)gmail.com> wrote in message news:1126020010.923973.255850(a)g44g2000cwa.googlegroups.com... > Folks, > > I need help ... in UNIX world it is relatively easy to set a variable > from a process. For example: > $ junk=`ls -altr | tail -1 | awk '{print $9}'` > $ echo ${junk} > > This sets variable 'junk' to the file name of most recent file. > > What's the trick to perform this in DOS world? TIA, > > -NK > XP has no DOS. It has, instead, the CMD shell which resembles DOS. XP calls similar things environment variables. One sets an environment variable via the set command in the cmd shell. It would be best to look in Help & Support before proceeding further. Jim
From: billious on 6 Sep 2005 12:12 <nkhimani(a)gmail.com> wrote in message news:1126020010.923973.255850(a)g44g2000cwa.googlegroups.com... > Folks, > > I need help ... in UNIX world it is relatively easy to set a variable > from a process. For example: > $ junk=`ls -altr | tail -1 | awk '{print $9}'` > $ echo ${junk} > > This sets variable 'junk' to the file name of most recent file. > > What's the trick to perform this in DOS world? TIA, > > -NK > within a batch file: for /f %%i in ('dir /b/o:d/a:-d c:\dirname\filemask') do set junk=%%i /a:-d suppresses directory names /o:d sorts in order of date. For the earliest, use /o:-d HTH ....Bill
From: Wesley Vogel on 6 Sep 2005 15:20 See Using environment variables with Cmd.exe Command shell Using environment variables http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx Type batch files and environment variables in the Search box in Help and Support. -- Hope this helps. Let us know. Wes MS-MVP Windows Shell/User In news:1126020010.923973.255850(a)g44g2000cwa.googlegroups.com, nkhimani(a)gmail.com <nkhimani(a)gmail.com> hunted and pecked: > Folks, > > I need help ... in UNIX world it is relatively easy to set a variable > from a process. For example: > $ junk=`ls -altr | tail -1 | awk '{print $9}'` > $ echo ${junk} > > This sets variable 'junk' to the file name of most recent file. > > What's the trick to perform this in DOS world? TIA, > > -NK
|
Pages: 1 Prev: User Accounts Next: Autostart |