Resgen.exe(资源文件生成器) 
您可以直接如图操作

转换时在 文本中先写好要转换的文件然后 全选 复制到控制台中
Filename.resx 要转换的文件 ResName1.resources 生成的resources 文件名

resgen E:\Filename1.resx e:\ResName1.resources
resgen E:\Filename2.resx e:\ResName2.resources
resgen E:\Filename3.resx e:\ResName3.resources
resgen E:\Filename4.resx e:\ResName4.resources
resgen E:\Filename5.resx e:\ResName5.resources
...................

每次批量转换的时候,都得先到文本中编辑一堆 resgen E:\Filename1.resx e:\ResName1.resources这样的命令一不小心还可能编辑错误,

答:方法肯定是有的!!!

右键 visual studio 命令提示(2010) 快捷方式 ,选择属性, ,复制起始位置: 你会发现 目标调用的是 ..\VC

下的一个批处理文件;

验证:

当我将 图片中 属性 =》 目标 文本框中的命令 赋值在在cmd中时发现 看红色部分!!!

这样的话,就happy了,我们可以通过代码方式用Process去启动 Resgen.exe

ArrayList  存放的是所有要转换的resx文件

resPath[0]="E:\Filename1.resx";

resPath[1]="E:\Filename2.resx";

为了避免手动向ArrayList 中赋值,可以在e:新建resxFile文件夹  将.resx存放e:\\resxFile这个里面然后遍历这个文件夹,for循环到ArrayList 中

特别注意:p.StandardInput.WriteLine("exit");要执行两次;

话说某人就因为只执行了一次,整了几天都没有找到原因)

private static string ResxToRes(ArrayList ResxPath)
{
//ResxFile 是一个文件夹,用来存放 需要转换的.resx 文件
string s = "";
Process p = new Process();
p.StartInfo.FileName = "cmd.exe"; p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.CreateNoWindow = true; p.Start(); // + '"' + '"' + 可以用 \"\" 替换
p.StandardInput.WriteLine("%comspec% /k " + '"' + '"' + @"d:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" + '"' + '"' + " x86 "); for (int i = 0; i < ResxPath.Count; i++)
{
string Filename = ResxPath[i].ToString();
string ResName = //根据需要写相应算法生成文件名; //resgen E:\Filename1.resx e:\ResName1.resources
p.StandardInput.WriteLine("resgen " + Filename + ""+"e:\\"+ResName+".resources"); p.StandardInput.WriteLine(" "); }
//此处要exit两次 //退出visual studio 到 cmd.exe
p.StandardInput.WriteLine("exit"); //退出cmd.exe
p.StandardInput.WriteLine("exit");
p.WaitForExit();
s = s + p.StandardOutput.ReadToEnd();
p.Close();
return s;
}
 

利用Resgen.exe 批量生成resources文件的更多相关文章

  1. FluentData-新型轻量级ORM 利用T4模板 批量生成多文件 实体和业务逻辑 代码

    FluentData,它是一个轻量级框架,关注性能和易用性. 下载地址:FlunenData.Model 利用T4模板,[MultipleOutputHelper.ttinclude]批量生成多文件 ...

  2. [原创] 利用前端+php批量生成html文件,传入新文本,输出新的html文件

    本人因为要想自己写个小说网站练练手,在其中遇到的一些问题,将其解决方法总结出来,例如: 1:小说网站存储了大量的小说,每个小说主页都很相似,url不同,不是使用的history属性改写的,所以如果人工 ...

  3. 如何利用Excel快速批量生成想要的代码

    如何利用Excel快速批量生成想要的代码 使用场景 在HTML DOM Video 对象这个页面 我想要将所有的中文描述和对应的属性(共32个属性)打印出来--console.log(descript ...

  4. 批量生成sqlldr文件,高速卸载数据

    SQL*Loader 是用于将外部数据进行批量高速加载的数据库的最高效工具,可用于将多种平面格式文件加载到Oracle数据库.SQL*Loader支持传统路径模式以及直接路径这两种加载模式.关于SQL ...

  5. 利用oxygen编辑并生成xml文件,并使用JAVA的JAXB技术完成xml的解析

    首先下载oxygen软件(Oxygen XML Editor),目前使用的是试用版(可以安装好软件以后get trial licence,获得免费使用30天的权限,当然这里鼓励大家用正版软件!!!) ...

  6. T4模板批量生成代码文件

    <#@ template debug="false" hostspecific="true" language="C#" #> ...

  7. 利用 autoconf 和 automake 生成 Makefile 文件

    一.相关概念的介绍 什么是 Makefile?怎么书写 Makefile?竟然有工具可以自动生成 Makefile?怎么生成啊?开始的时候,我有这么多疑问,所以,必须得先把基本的概念搞个清楚. 1.M ...

  8. T4批量生成多文件

    http://www.cnblogs.com/zengxiangzhan/p/3250105.html Manager.ttinclude <#@ assembly name="Sys ...

  9. asp.net asp.net application 升级到 asp.net web 解决找不到控件 批量生成.designer文件

    颇费周折后,其实很简单,只需要生成designer文件后,重新保存所有页面即可.就是懒得写.懒真的是一种病,手上不能懒,脑子里更不能懒,否则就是给自己挖坑,仔细认真,注意细节!!!! PS:注意修改p ...

随机推荐

  1. chop函数

    chop() 函数从字符串的末端开始删除空白字符或其他预定义字符. chop(string,charlist) 参数 描述 string 必需.规定要转换的字符串. charlist 可选.规定从字符 ...

  2. NullReferenceException UnityEngine.Transform.get_localPosition

    NullReferenceException  UnityEngine.Transform.get_localPosition unity程序中,需要取得GO自身的Transform,出现如上空异常, ...

  3. Caffe proto閱讀

    --------------------------------------------------------------------------------- 1.Data Layer sourc ...

  4. 导入别人的flex项目出现的问题

    1.unable to open 'D:/flex-projects/RoadService/WebContent/WEB-INF/flex/services-config.xml' 这种情况是因为别 ...

  5. leetcode51. N-Queens

    The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens ...

  6. 设置Android studio黑色主题

    设置: 如上图,点击[Theme]下拉选项,选中[Darcula]主题,点击[Apply]应用修改,弹出重启Android Studio生效修改.如图:

  7. GDB中文手册

    用GDB调试程序GDB概述 2使用GDB 5GDB中运行UNIX的shell程序 8在GDB中运行程序 8调试已运行的程序 两种方法: 9暂停 / 恢复程序运行 9一.设置断点(BreakPoint) ...

  8. 论文笔记之:Large Scale Distributed Semi-Supervised Learning Using Streaming Approximation

    Large Scale Distributed Semi-Supervised Learning Using Streaming Approximation Google  2016.10.06 官方 ...

  9. Python之路,day2-Python基础1

    python2 range(20) for i in range(10): print(i) range(1,10)  ----->从1开始到9 else: #如果for循环正常结束,  就执行 ...

  10. Alpha版本——Postmortem会议

    No Bug 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 设想和目标 1.我们的软件要解决什么 ...