RenameFile.cpp
来源:互联网 发布:邮箱反查域名 编辑:程序博客网 时间:2024/06/06 12:20
// RenameFile.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "RenameFile.h"//#include "windows.h"#include "shlwapi.h"/*包含头文件 Shlwapi.hLibrary Shlwapi.lib*/#pragma comment(lib,"Shlwapi.lib")#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// The one and only application objectCWinApp theApp;using namespace std;int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]){int nRetCode = 0;// initialize MFC and print and error on failureif (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)){// TODO: change error code to suit your needscerr << _T("Fatal Error: MFC initialization failed") << endl;nRetCode = 1;}else{if (argc<3){printf("usage: %s filename <file tail to add>\n",argv[0]);exit(-1);}// TODO: code your application's behavior here.TCHAR m_OldName[256];TCHAR m_NewName[256];TCHAR OldFileName[256];//<=m_OldNameTCHAR OldFileExt[256];//MessageBox(NULL,argv[1],argv[0],MB_OK);//exit(0);strcpy(m_OldName,argv[1]);//MessageBox(NULL,m_OldName,argv[0],MB_OK);//exit(0);LPSTR ext;//如"D:\\masm32\\lcd\\lcd.asm",则可返回".asm"的首址ext = PathFindExtension(m_OldName);strcpy(OldFileExt,ext);*ext='\0';strcpy(OldFileName,m_OldName);//printf(m_OldName);//exit(0);strcpy(m_NewName,OldFileName);strcat(m_NewName,argv[2]);strcat(m_NewName,OldFileExt);//printf(m_NewName);//exit(0);try { CFile::Rename(argv[1], m_NewName); } catch(CFileException* pEx ) { TRACE(_T("Rename File %20s Exception, cause =%d\n"), argv[1], pEx->m_cause); pEx->Delete(); } }return nRetCode;}
桌面\新建文件夹>for %a in (*.h) do RenameFile.ex
e "%a" _offline
- RenameFile.cpp
- vbs脚本:RenameFile
- Delphi RenameFile 文件改名
- cpp
- CPP
- CPP
- cpp
- cpp
- CPP
- CPP
- ClientSockThread.cpp&&ClientUrlThread.cpp
- cpp调用其他cpp
- ex34a.cpp&&ex34aDoc.cpp&&ex34aView.cpp
- MainFrm.cpp&&ServerThread.cpp&&SheetConfig.cpp
- CPP thread
- cpp->html
- CFaderWnd.cpp
- PasswordReminder.cpp
- DIV+CSS相对IE6、IE7和IE8的兼容问题
- css圆角
- Play2.1 简单总结之二:Play Framework 的使用
- java操作数据库的类——SqlHelper(简易版)
- HttpServletRequest.getRemoteAddr之代理提交
- RenameFile.cpp
- fmpp代码生成po(一)
- Linux必学的60个命令
- 除去次方数 自然数的平方数是:1 4 9 16 25 … 自然数的立方数是:1 8 27 64 125 … 自然数的4次方数是:1 16 81 256 …
- eclipse 快捷键
- ip4和ipv6的路由匹配
- textarea保存原文的空格和回车
- mmap详解
- 手把手教你把Vim改装成一个IDE编程环境(图文)