Windows 7 Forums


Reply
Thread Tools

[SOLVED] Elmers Batch file writing issue #2

 
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      10-23-2010
I'm trying to write a batch file that will:-
a) Take full ownership
b) Rename original file
c) Copy replacement file from point A (different) to the original locations (system 32 and SysWOW64 involved here)

The story so far:-
Code:
@echo off
takeown /f C:\Windows\System32\Elmers.rtf
cacls C:\Windows\System32\Elmers.rtf
REN C:\Windows\System32\Elmers.rtf Elmers0ld.rtf
COPY "D:\ MODIFYING\7 DLL+ W.I.P.s\Elmers.rtf" "C:\Windows\System32\Elmers.rtf"
N.B. The space at the start of the folder called " Modifying" (its an "Alt+ 160) is deliberate, not a typo.

I've made a mock up so I'm assuming the first two (takeown & cacls) are working.
Update, Appears not!!
The rename bit works no problem. It's the copying of the replacement file that's not happening for me

This is to automate (eventually!) the changing of my imageres.dll file and another three or four system files I've modified and always change. Thus speeding up a pretty fast routine I've already got (by hand).

Help appreciated.

Update, Appears not!! Tried on a system file, didn't work. Looks like I need to start from scratch .

Last edited by Elmer BeFuddled; 10-23-2010 at 10:24 PM.. Reason: clarification
 
Reply With Quote
 
 
 
 
Core Core is offline
throwing darts
Core's Avatar
Join Date: Feb 2009
Location: Akaa, Finland
Posts: 849
Thanked: 177
Send a message via MSN to Core Send a message via Yahoo to Core Send a message via Skype™ to Core Core's Twitter Pag
 
      10-23-2010
So if you enter them by hand one by one, they do work?
 
Reply With Quote
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      10-23-2010
Quote:
Originally Posted by Core View Post
So if you enter them by hand one by one, they do work?
You mean like, one batch to take ownership, pause, one to rename, pause, one to replace?
I'll give that a go.
 
Reply With Quote
 
IonDarkWatch IonDarkWatch is offline
New Member
IonDarkWatch's Avatar
Join Date: Oct 2010
Posts: 13
Thanked: 1
 
      10-24-2010
Quote:
Originally Posted by Elmer BeFuddled View Post
I'm trying to write a batch file that will:-
a) Take full ownership
b) Rename original file
c) Copy replacement file from point A (different) to the original locations (system 32 and SysWOW64 involved here)

The story so far:-
Code:
@echo off
takeown /f C:\Windows\System32\Elmers.rtf
cacls C:\Windows\System32\Elmers.rtf
REN C:\Windows\System32\Elmers.rtf Elmers0ld.rtf
COPY "D:\ MODIFYING\7 DLL+ W.I.P.s\Elmers.rtf" "C:\Windows\System32\Elmers.rtf"
N.B. The space at the start of the folder called " Modifying" (its an "Alt+ 160) is deliberate, not a typo.

I've made a mock up so I'm assuming the first two (takeown & cacls) are working.
Update, Appears not!!
The rename bit works no problem. It's the copying of the replacement file that's not happening for me

This is to automate (eventually!) the changing of my imageres.dll file and another three or four system files I've modified and always change. Thus speeding up a pretty fast routine I've already got (by hand).

Help appreciated.

Update, Appears not!! Tried on a system file, didn't work. Looks like I need to start from scratch .
http://www.blogsdna.com/2159/how-to-...-windows-7.htm

Last edited by clifford_cooley; 10-24-2010 at 01:12 AM..
 
Reply With Quote
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      10-24-2010
Thanks for the Link IonDarkWatch, but I know how to take ownership of a file or folder.

Just not with my crappy .bat file!!

I'm trying to simplify that process (and others) into one mouse double-click for multiple randomly located files if possible.
 
Reply With Quote
 
Core Core is offline
throwing darts
Core's Avatar
Join Date: Feb 2009
Location: Akaa, Finland
Posts: 849
Thanked: 177
Send a message via MSN to Core Send a message via Yahoo to Core Send a message via Skype™ to Core Core's Twitter Pag
 
      10-24-2010
Quote:
Originally Posted by Elmer BeFuddled View Post
You mean like, one batch to take ownership, pause, one to rename, pause, one to replace?
I'll give that a go.
No, I meant if you type the commands one by one into the command prompt, do you get auth probs or do they process...
 
Reply With Quote
 
Fire cat Fire cat is offline
Established Member
Join Date: Mar 2010
Posts: 1,156
Thanked: 164
 
      10-24-2010
I know that you want to make a batch file, but you can Aldo do this with a Java app called Actions. I use it to create new projects when I code
http://app.jbbres.com/actions/
 
Reply With Quote
 
Elmer BeFuddled Elmer BeFuddled is offline
Resident eejit
Elmer BeFuddled's Avatar
Join Date: Jun 2010
Location: Durham UK
Posts: 1,050
Thanked: 203
Send a message via Skype™ to Elmer BeFuddled
 
      10-24-2010
Quote:
Originally Posted by Core View Post
No, I meant if you type the commands one by one into the command prompt, do you get auth probs or do they process...
Okay my icacls was all wrong! Modified the code to
Code:
takeown /f C:\Windows\Elmers.rtf
icacls C:\Windows\Elmers.rtf  /grant administrators:F /t
REN C:\Windows\Elmers.rtf Elmers0ld.rtf
COPY "D:\ MODIFYING\7 DLL+ W.I.P.s\Elmers.rtf" "C:\Windows\Elmers.rtf"
We now have take ownership and rename but no copy .

"The system cannot find the path specified". I've tried the copy with and without "quotes".

Fire Cat I'll have to look into that, Thanks for the link.

Last edited by Elmer BeFuddled; 10-24-2010 at 01:46 PM..
 
Reply With Quote
 
Fire cat Fire cat is offline
Established Member
Join Date: Mar 2010
Posts: 1,156
Thanked: 164
 
      10-24-2010
You're welcome M8!
 
Reply With Quote
 
Core Core is offline
throwing darts
Core's Avatar
Join Date: Feb 2009
Location: Akaa, Finland
Posts: 849
Thanked: 177
Send a message via MSN to Core Send a message via Yahoo to Core Send a message via Skype™ to Core Core's Twitter Pag
 
      10-24-2010
Quote:
Originally Posted by Elmer BeFuddled View Post
Okay my icacls was all wrong! Modified the code to
Code:
takeown /f C:\Windows\Elmers.rtf
icacls C:\Windows\Elmers.rtf  /grant administrators:F /t
REN C:\Windows\Elmers.rtf Elmers0ld.rtf
COPY "D:\ MODIFYING\7 DLL+ W.I.P.s\Elmers.rtf" "C:\Windows\Elmers.rtf"
We now have take ownership and rename but no copy .

"The system cannot find the path specified". I've tried the copy with and without "quotes".

Fire Cat I'll have to look into that, Thanks for the link.
When you type out the copy command, make sure you enter the space before the word MODIFYING not with a space key, but by holding down ALT and typing 0160 on your numpad.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stand-Alone Software Every 7 System Should Have Available Elmer BeFuddled General Discussion 6 05-15-2011 06:52 AM
Script (Batch File) Writing... Elmer BeFuddled General Discussion 13 06-27-2010 11:47 PM
Running a batch file on shutdown win7 64 bit masplin General Discussion 0 03-21-2010 01:03 PM
Windows 7 install keeps rebooting Stephen47 Installation, Setup and Updates 32 05-24-2009 06:26 PM
Important Issues in This Release Candidate of Windows 7 Ian News 0 05-05-2009 03:25 PM


All times are GMT +1. The time now is 03:11 PM.
W7Forums is an independent website and is not affiliated with Microsoft Corporation.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33