RE: DOS Batch File Question

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 30 Jun 2010 23:42:08 -0400

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

Other related posts: