Unity编辑器调用外部exe程序 和 windows文件夹
直接来,1个脚本
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using Debug = UnityEngine.Debug; public class Excel2LuaEditor : EditorWindow
{
[MenuItem("工具/生成Lua Card")]
static void GenLuaCard()
{
Debug.Log("生成卡牌 Lua");
ProcessCommand(@"D:\UnitySSDProject\GameTRPG\GameTRPG\工具\Excel2Lua\Excel2Lua\Lua生成器\cardexe\bin\Excel2Lua.exe", null);
} [MenuItem("工具/生成Lua Buff")]
static void GenLuaBuff()
{
Debug.Log("生成Buff Lua");
ProcessCommand(@"D:\UnitySSDProject\GameTRPG\GameTRPG\工具\Excel2Lua\Excel2Lua\Lua生成器\buffexe\bin\Excel2Lua.exe", null);
} private static void ProcessCommand(string command, string argument){
ProcessStartInfo start = new ProcessStartInfo(command);
start.Arguments = argument;
start.CreateNoWindow = false;
start.ErrorDialog = true;
start.UseShellExecute = true; if(start.UseShellExecute){
start.RedirectStandardOutput = false;
start.RedirectStandardError = false;
start.RedirectStandardInput = false;
} else{
start.RedirectStandardOutput = true;
start.RedirectStandardError = true;
start.RedirectStandardInput = true;
start.StandardOutputEncoding = System.Text.UTF8Encoding.UTF8;
start.StandardErrorEncoding = System.Text.UTF8Encoding.UTF8;
} Process p = Process.Start(start); if(!start.UseShellExecute){
Debug.Log(p.StandardOutput);
Debug.Log(p.StandardError);
} p.WaitForExit();
p.Close();
}
}
打开文件夹
[MenuItem("工具/打开Excel文件夹")]
static void OpenFolder()
{
string path = @"D:\UnitySSDProject\GameTRPG\GameTRPG\Assets\StreamingAssets\Excel\COC7th";
System.Diagnostics.Process.Start("explorer.exe", path);
}
参考资料:
https://www.jianshu.com/p/3f4120a7c7f6
Unity编辑器调用外部exe程序 和 windows文件夹的更多相关文章
- windows下调用外部exe程序 SHELLEXECUTEINFO
本文主要介绍两种在windows下调用外部exe程序的方法: 1.使用SHELLEXECUTEINFO 和 ShellExecuteEx SHELLEXECUTEINFO 结构体的定义如下: type ...
- c# 调用外部exe程序
c#调用外部exe程序,首先要 using System.Diagnostics; 然后开启一个新process System.Diagnostics.ProcessStartInfo p=null; ...
- [转]VC中调用外部exe程序方式
本文转自:http://blog.sina.com.cn/s/blog_486285690100ljwu.html 目前知道三种方式:WinExec,ShellExecute ,CreateProce ...
- C++调用外部应用程序
很多时候,我们的程序需要调用DOS命令,通过Dos命令调用其他程序从而完成所需要完成的功能.比如,调用Dos程序PKZIP完成ZIP包的解压缩,调用SVN完成文件的更新或者上传.但是在程序运行时又要求 ...
- C#和asp.net执行外部EXE程序
这两天研究下.Net的执行外部EXE程序问题,就是在一个程序里通过按钮或其他操作运行起来另外一个程序,需要传入参数,如用户名.密码之类(实际上很类似单点登录,不过要简单的多的多):总结如下: 1.CS ...
- C# ASP.NET Webservice调用外部exe无效的解决方法
最近用asp.net做webservice,其中有个功能是调用执行外部的exe(类似cmd中执行),但执行Process.Start之后就没有结果,同样代码在winform下正常,折腾两天终于找到解决 ...
- Notepad++中调用cl.exe编译器(Windows)
Notepad++中调用cl.exe编译器(Windows) 近来在notepad++中写代码,写完后总是习惯性的想去VS里面编译一下,看看代码是否有误.但有时候一些零碎的小文件总是懒得再VS中打开, ...
- sqlserver数据库触发器调用外部exe
sqlserver数据库触发器调用外部exe,同事可以选择参入参数! sqlserver使用 master..xp_cmdshell 进行外部exe的执行. 使用master..xp_cmdshell ...
- html网页调用本地exe程序的实现方法:
html网页调用本地exe程序的实现方法:1.新建注册表具体文件: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\hhtpexe] [ ...
- C# 服务里面调用Python.exe 来执行python文件
问题描述:在WCF服务里面通过调用python.exe来执行py文件,像下面这样py文件路径+参数,用空格隔开.会出现调用结果为空的现象 System.Diagnostics.ProcessStart ...
随机推荐
- 数据库问题之“字符编码问题 Cause: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x8E\x81\xE7\x88...' for column 'product_name' at row 41”
1)表1和表2的产品名称[数据库字段]字符编译方式不一致 ①问题 org.springframework.jdbc.UncategorizedSQLException: Error updating ...
- Python基础 - 控制结构
控制结构: 顺序, 分支, 循环, 理解了, 其实编程就入门一半了. 条件表达式 条件表达式的值只要不是:0 . None. False. 空列表. 空元组. 空集合. 空字典. 空字符串. 空ran ...
- C++11 auto和decltype关键字
今天来看下C++中的auto和decltype两个关键字 auto关键字定义变量,编译器会自动判断变量的类型 举个栗子: auto i =100; // i 是 int auto p = new A( ...
- Django踩坑之在Django中创建项目时ImportError: No module named django.core
不使用django-admin.py,而是使用django-admin.exe 具体操作如下 django-admin.exe startproject learning_log . ok,没有提示错 ...
- lambdo表达式
************************************************************************* 原作者:ioriogami 原文:https://b ...
- odoo14使用的文件服务器【NFS】
linux系统之间要文件共享实现方式:目前测试系统为Ubuntu20.04LTS 条件:1.保证两个系统都是linux: 2.目前实现是同一个局域网内: 服务端:172.26.1 ...
- C#获得项目最后编译时间
C#获得项目最后编译时间 效果 具体格式可以自定义 核心代码 string GetCompileVersion() { string OriginVersion = "" + Sy ...
- Ai数学基础
数学基础 1.梯度 1.1偏导数 1.1.1定义 1.1.2几何意义 1.2方向导数 1.2.1定义 1.2.2定理 注:主要运用上面那个公式来计算! 1.3梯度的概念 注:gradf 表示梯度! 1 ...
- 尚硅谷Vue2.0+3.0的笔记资料(cli开始)
笔记 脚手架文件结构 ├── node_modules ├── public │ ├── favicon.ico: 页签图标 │ └── index.html: 主页面 ├── src │ ├── a ...
- C# Json 解析,针对数字开头变量Json字符串转模型(Model)
namespace 解析数字开头的变量JSON { class Program { static void Main(string[] args) { string strJson = "{ ...