惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - neoragex2002

Source Insight小技巧:修改Symbol Window的默认宽度 Visual Studio 2015 msvsmon.exe crashed when c++ debugging with x64 高级屏幕空间反射: Screen Space Reflection (SSSR) 高级屏幕空间反射: Screen Space Reflection (SSR) SVO实时全局光照优化(里程碑MK2):Sparse Voxel Octree based Global Illumination (SVO GI) SVO实时全局光照优化(里程碑MK0):Sparse Voxel Octree based Global Illumination (SVO GI) SVO实时全局光照:中等规模场景的GI实现 SVO实时全局光照:Sparse Voxel Octree based Global Illumination (SVO GI) Windows 10开启默认网络驱动器访问 Spectrum to XYZ to sRGB H-Basis/SG/SH GI Relighting HQ-SSAO (High-Quality SSAO) 安装astrixx firefox插件 Approx Analytic Arealight 一次性将多个文件夹批处理压缩成多个.rar Xbox One手柄 + Xbox Wireless Adapter PC无线适配器驱动安装、配对全流程 PX4/PixHawk无人机飞控应用开发 传统D3D11程序面向VS2015编译环境的配置修正细节 Clustered Shading架构实现步骤
Win32 CMD批处理命令
neoragex2002 · 2019-04-29 · via 博客园 - neoragex2002

1. win32批处理下,另开一个console执行进程X

使用start [/K|/C],示例:

//--------------------------------------------------------------------------------------
//example 1: 新开console,执行dir命令完毕后,不自动关闭console
start cmd /K dir 

//--------------------------------------------------------------------------------------
//example 2: 新开console,执行dir命令完毕后,自动关闭console
start cmd /C dir 

//--------------------------------------------------------------------------------------
//example 3: 完整示例
start /D D:\demo-dev\dev_native\demoICE\x64\Release cmd /K demoICE.exe server
start /D D:\demo-dev\dev_native\demoICE\x64\Release cmd /K demoICE.exe client

注意:start命令是不会拥塞当前控制台的.bat执行的。

2. 指定start的启动目录

使用start /D,示例如下:

start /D c:\

3. 与linux后台运行(&)等价的start操作

使用start /b,示例如下:

in win32 console:
start /b iperf.exe > c:\iperf_multicast_server_logfile.txt

in linux console:
/root/iperf1.7 > /root/iperf_multicast_client_logfile.txt &

参考文献:http://blog.csdn.net/u012377333/article/details/41824787

4. 使用python脚本同时启动多console进程

参考文献:

  1. https://stackoverflow.com/questions/6469655/how-can-i-spawn-new-shells-to-run-python-scripts-from-a-base-python-script
  2. https://stackoverflow.com/questions/15899798/subprocess-popen-in-different-console
  3. https://docs.python.org/2/library/subprocess.html

示例如下:

//example 1:
from subprocess import Popen, CREATE_NEW_CONSOLE
Popen('cmd', creationflags=CREATE_NEW_CONSOLE)

//--------------------------------------------------------------------------------------
//example 2:
from sys import executable
from subprocess import Popen, CREATE_NEW_CONSOLE
Popen([executable, 'script.py'], creationflags=CREATE_NEW_CONSOLE)

//--------------------------------------------------------------------------------------
//example 3:
from subprocess import Popen, CREATE_NEW_CONSOLE
Popen('cmd dir', creationflags=CREATE_NEW_CONSOLE, cwd='c:\\')
Popen(['cmd', '/C', 'dir'], creationflags=CREATE_NEW_CONSOLE, cwd='c:\\')

//--------------------------------------------------------------------------------------
//example 4:
from shlex import split
from subprocess import Popen, CREATE_NEW_CONSOLE
cmd_1 = "cmd /K demoICE.exe server";
cmd_2 = "cmd /K demoICE.exe client";
args_1 = split(cmd_1);
args_2 = split(cmd_2);
Popen(args_1, creationflags=CREATE_NEW_CONSOLE, cwd="D:\\demo-dev\\dev_native\\demoICE\\x64\\Release");
Popen(args_2, creationflags=CREATE_NEW_CONSOLE, cwd="D:\\demo-dev\\dev_native\\demoICE\\x64\\Release");