Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


I hate windows console rename command in a shell

  • Please log in to reply
No replies to this topic

#1 GoofProg


  • Banned
  • 224 posts
  • Gender:Male
  • Local time:10:34 AM

Posted 29 May 2017 - 12:10 PM

rename was purposely used like so

rename originalcompletepath nameofnewrenamedfile in current directory

I was shelling out to the console via system () in process.h and I bumped into this problem.

I guess they made it like that on purpose to minimize damage from a rouge app renaming files.

I guess I have to think like a virus writer.  I got around the problem by using copy and then the user has a decision to erase the files.

I'll have to tranverse a tree and get all the files in that directory for local renaming uninstead a full path like the copy command can.



char command_str[1024]={0};
char old[512]={0},new[512]={0};
//get file names from app arguments
sprintf(command_str, "rename %s %s",old,new);
//does not work too well
sprintf(command_str, "copy %s %s",old,new);
//works but it goes slow because it is replicating data.

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users