Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows x64 Edition
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Deleting and renaming files using Batch file on Windows 7 x64

Windows x64 Edition


Reply
 
Thread Tools Search this Thread
  #1  
Old 17-05-2011
Member
 
Join Date: Apr 2011
Posts: 63
Deleting and renaming files using Batch file on Windows 7 x64

I want to create personal shortcut on my desktop for changing password using shiftkeys .exe (C:\Windows\System32\sethc.exe). I want to automate the process in a way where my batch file will remove itself after completing its task. I am having .exe file renaming sethc.exe to sethc2.exe, Below is the code that i am using:

del sethc.exe
ren sethc2.exe sethc.exe
del %0

Batch file is deleting itself somehow but it's not able to remove of the .exe and the renaming. Is there anything that i am missing out here????

Reply With Quote
  #2  
Old 17-05-2011
Member
 
Join Date: May 2008
Posts: 991
Have you tried running above BAT file with Administrative privileges?? If not than right click on it and try running it as Administrator and check out if that's making any difference. If you still don't get lucky than try running it as followed:
]del /F /S /Q /A sethc.exe
ren sethc2.exe sethc.exe
del %0

Let me know if you find it helping.

For reference:
/F - Force deleting read only files.
/S - Deletes specified files from sub-directories.
/Q - It's Quite mode and it would not prompt if it is ok to remove all the global wild cards.
/A - It choose a file and delete it on the basis of the provided attribute.
Reply With Quote
  #3  
Old 17-05-2011
Member
 
Join Date: Apr 2009
Posts: 1,106
As far as i can guess you might not be having ownership of the file. sethc.exe is owned by TrustedInstaller and one needs to have ownership of it, one should set file's permissions to "Allow" your user account "Full Control" of the file as well. Just cross check and make sure that you are having above conditions true, if not than file wont get deleted.
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows x64 Edition
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Deleting and renaming files using Batch file on Windows 7 x64"
Thread Thread Starter Forum Replies Last Post
Need batch file to delete user files in Windows XP mcamp32 Windows XP Support 1 26-05-2011 10:54 PM
Renaming and Deleting a file with Java Spy$Eyes Tips & Tweaks 4 08-09-2010 10:07 PM
Deleting files equal to 0 in a batch file. Luis-Fernando Operating Systems 5 27-03-2010 08:04 PM
A Simple File and Folder renaming batch code : RenameR Rudra.J Tips & Tweaks 2 05-03-2009 02:59 PM
Batch Renaming Software for files inside zip Aditix360 Windows Software 2 30-01-2009 10:18 AM


All times are GMT +5.5. The time now is 06:51 PM.