RE: DOS Batch File Question

  • From: "DaShiell, Jude T. CIV NAVAIR 1490, 1, 26" <jude.dashiell@xxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 7 Jul 2010 08:49:16 -0400

The dos find command has a /v switch you may find useful.  If memory
serves, you filter lines out with that /v switch and would probably end
up using a temporary file then copying the temporary file over the
original file.  Then if all goes well, erase the temporary file.  Grep
and sed could easily accomplish this task if the environment is larger
than dos though. 

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ken Perry
Sent: Wednesday, June 30, 2010 23:42
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: DOS Batch File Question

If I wanted to do this I would skip batch and write it in python then
compile it to an executable and send it to everyone.

 

Ken

 

 

From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Donald
Marang
Sent: Wednesday, June 30, 2010 11:06 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: DOS Batch File Question

 

I was attempting to help someone write a batch file to help configure
VMware Player to use a preconfigured Vinux Virtual Machine.  We want to
modify the %AppData%\VMware\preferences.ini file to set the hotkey
combination to Alt + Control + Shift.  To do this, I need the batch file
to do two things.  

 

1.  Delete  any lines that contain the word "hotkey" that are currently
in the file.  Two definitions are not permitted in this file.  There are
other similar lines that appear in this file, but only this line seems
to be processed in the newest versions of the software.  

 

2.  Append a line at the bottom of the file to define the desired hotkey
with the command:  

echo 'pref.hotkey.shift="true"' >> %AppData%\VMware\preferences.ini

 

Obviously, I know how to get the second task done.  Can anybody help me
with the first?  We would need it to work in XP, Vista and Windows 7.
In Linux, I think a simple sed statement would do the trick, like 

sed 'hotkey/d' ${AppData}/VMware/preferences.ini

 

I am just guessing at the above hypothetical syntax as well.  I have not
attempted anything like that in years.Does anybody know how to modify
text files in DOS?  I ran across 'munge', which could have accomplished
this as long as an additional definitions file was used.  I use the past
tense since it has not been around for a long time.  There must be some
such capability to search and destroy!  The 'FIND' command can locate
the lines.  I want them deleted as well. 

 

Don Marang

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: