简体   繁体   English

Windows命令行:启动/等待wordpad

[英]Windows command line: start /wait wordpad

Hi, when I run the following BAT file, it doesn't wait for Wordpad to terminate. 嗨,当我运行以下BAT文件时,它不会等待Wordpad终止。 Notepad starts immediately. 记事本立即启动。 How can I make it wait? 我怎么能让它等待? I am using 64-bit Windows 7. 我使用的是64位Windows 7。

REM Close notepad.
taskkill /im notepad.exe /f
REM Start Wordpad and wait until it terminates.
start /wait write.exe C:\Users\dell\Downloads\test.txt
REM Restart Notepad.
start notepad.exe C:\Users\dell\Downloads\test2.txt
PAUSE

A perfect question for procmon ! 对于一个完美的问题莫过于procmon

On my system (also Windows 7), write.exe actually starts up the wordpad.exe process and then exits. 在我的系统(也是Windows 7)上,write.exe实际上启动了wordpad.exe进程,然后退出。 Since your "start /wait" is only waiting on write.exe, it returns as soon as write.exe exits. 由于您的“开始/等待”仅在write.exe上等待,因此只要write.exe退出就会返回。

procmon屏幕

If you do "start /wait wordpad.exe ...", it should indeed wait until wordpad exits. 如果你“开始/等待wordpad.exe ...”,它应该等到wordpad退出。

开始/等待记事本&&启动wordpad

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 启动C#Windows应用程序,然后等待在命令行中退出 - Start a C# windows application and wait for exiting in command line Windows命令行在下一个命令之前等待任务结束 - Windows Command Line wait for task end before next command 如何从Windows中的命令行启动可执行文件 - how to start executable from command line in windows Python:在 Windows 上启动新的命令提示符并等待它完成/退出 - Python: Start new command prompt on Windows and wait for it finish/exit Windows 命令行:START 命令开关 /I 是什么意思? - Windows Command Line : START Command Switch /I meaning? 使用消息在Windows中控制写字板 - Controlling Wordpad in Windows using messages Windows快捷方式上相当于“开始于”字段的命令行 - Command-line equivalent of “start in” field on windows shortcuts 如何在Windows上从命令行启动MingW控制台(GitBash)? - How to start MingW Console (GitBash) from Command Line on Windows? 在Windows中通过命令行启动没有菜单/地址栏的IE - start IE with no menu/address bar through command line in Windows 从Windows命令行启动时,Apache Derby(JavaDB)静默失败 - Apache Derby (JavaDB) fails silently at start from Windows command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM