草庐IT

windows - 调用 "start myapp"和 "myapp"的区别

coder 2023-11-11 原文

在 Windows 批处理文件或命令提示符中,调用 start mspaintmspaint 之间有什么区别?它们似乎在做完全相同的事情。

另一个例子,所有 4 个案例似乎都在做同样的事情。如果有的话,你能帮我理解一下细微的差别是什么吗?

  1. taskmgr
  2. C:\Windows\System32\Taskmgr.exe
  3. 启动taskmgr
  4. 启动 C:\Windows\System32\Taskmgr.exe

跟进:看起来 start 打开一个单独的后台命令提示符来运行您在它之后编写的程序(来源:https://technet.microsoft.com/en-us/library/cc770297(v=ws.11).aspx)。这是否与 Linux 的 myApp & 格式相同——您在其中具有 & 后缀?

最佳答案


启动程序

看到开始/?并调用/?寻求所有三种方式的帮助。

指定程序名

c:\windows\notepad.exe

在批处理文件中,批处理将等待程序退出。什么时候 输入命令提示符不等待图形 程序退出。

如果程序是一个批处理文件控制权被转移并且调用批处理文件的其余部分不被执行。

使用启动命令

start "" c:\windows\notepad.exe

Start 启动一个程序并且不等待。控制台程序在新窗口中启动。使用/b 开关强制控制台程序进入同一窗口,这否定了启动的主要目的。

开始使用 Windows 图形外壳 - 与键入 WinKey + R(运行对话框)相同。尝试

start shell:cache

另请注意,第一组引号(如果有)必须是窗口标题。

使用调用命令

调用用于启动批处理文件并等待它们退出并继续当前的批处理文件。


引用 Start 并输入程序名称。

帮助 Windows 查找程序和文档

可以将程序和文档添加到注册表中,因此在“开始”-“运行”对话框或快捷方式中键入不带路径的名称可以让 Windows 找到它们。

REGEDIT4
;The bolded name below is the name of the document or program, <filename>.<file extension> 

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\IE.txt]

;The @ means the path to the file is assigned to the default value for the key.
;The whole path in enclosed in a quotation mark ".

@="\"C:\\Program Files\\Internet Explorer\\IE.txt\""

;Optional Parameters. The semicolon means don't process the line. Remove it if you want to put it in the registry

;Informs the shell that the program accepts URLs.

;"useURL"="1"

;Sets the path that a program will use as its' default directory. This is commented out.

;"Path"="C:\\Program Files\\Microsoft Office\\Office\\"

用于技术讨论。

CMD 预处理命令并找到文件,然后调用 CreateProcess。开始 - 运行对话框或 Start 命令使用最终调用 CreateProcessShellExecuteEx

这是 CreateProcess 规则 - 注意 CMD 提供了 CreateProcess 的完整路径。 https://msdn.microsoft.com/en-us/library/ms682425

1.The directory from which the application loaded.

2.The current directory for the parent process.

3.The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.

  1. The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.

5.The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.

6.The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.

ShellExecuteEx 在这里 https://msdn.microsoft.com/en-us/library/bb759784(v=vs.85).aspx

CMD 预处理在我的 Skydrive 上可用 - 最初来自 MS 网站,但仅此而已。请参阅 Windows NT 命令外壳第 2 章 https://1drv.ms/f/s!AvqkaKIXzvDieQFjUcKneSZhDjw

关于windows - 调用 "start myapp"和 "myapp"的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39923429/

有关windows - 调用 "start myapp"和 "myapp"的区别的更多相关文章

  1. ruby - 在 Ruby 程序执行时阻止 Windows 7 PC 进入休眠状态 - 2

    我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0

  2. ruby-on-rails - rails : "missing partial" when calling 'render' in RSpec test - 2

    我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou

  3. ruby-on-rails - 由于 "wkhtmltopdf",PDFKIT 显然无法正常工作 - 2

    我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-

  4. ruby - 检查 "command"的输出应该包含 NilClass 的意外崩溃 - 2

    为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar

  5. ruby - 触发器 ruby​​ 中 3 点范围运算符和 2 点范围运算符的区别 - 2

    请帮助我理解范围运算符...和..之间的区别,作为Ruby中使用的“触发器”。这是PragmaticProgrammersguidetoRuby中的一个示例:a=(11..20).collect{|i|(i%4==0)..(i%3==0)?i:nil}返回:[nil,12,nil,nil,nil,16,17,18,nil,20]还有:a=(11..20).collect{|i|(i%4==0)...(i%3==0)?i:nil}返回:[nil,12,13,14,15,16,17,18,nil,20] 最佳答案 触发器(又名f/f)是

  6. ruby-on-rails - 迷你测试错误 : "NameError: uninitialized constant" - 2

    我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test

  7. ruby-on-rails - 相关表上的范围为 "WHERE ... LIKE" - 2

    我正在尝试从Postgresql表(table1)中获取数据,该表由另一个相关表(property)的字段(table2)过滤。在纯SQL中,我会这样编写查询:SELECT*FROMtable1JOINtable2USING(table2_id)WHEREtable2.propertyLIKE'query%'这工作正常:scope:my_scope,->(query){includes(:table2).where("table2.property":query)}但我真正需要的是使用LIKE运算符进行过滤,而不是严格相等。然而,这是行不通的:scope:my_scope,->(que

  8. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  9. ruby - 安装 Ruby 时遇到问题(无法下载资源 "readline--patch") - 2

    当我尝试安装Ruby时遇到此错误。我试过查看this和this但无济于事➜~brewinstallrubyWarning:YouareusingOSX10.12.Wedonotprovidesupportforthispre-releaseversion.Youmayencounterbuildfailuresorotherbreakages.Pleasecreatepull-requestsinsteadoffilingissues.==>Installingdependenciesforruby:readline,libyaml,makedepend==>Installingrub

  10. ruby-on-rails - `a ||= b` 和 `a = b if a.nil 之间的区别? - 2

    我正在检查一个Rails项目。在ERubyHTML模板页面上,我看到了这样几行:我不明白为什么不这样写:在这种情况下,||=和ifnil?有什么区别? 最佳答案 在这种特殊情况下没有区别,但可能是出于习惯。每当我看到nil?被使用时,它几乎总是使用不当。在Ruby中,很少有东西在逻辑上是假的,只有文字false和nil是。这意味着像if(!x.nil?)这样的代码几乎总是更好地表示为if(x)除非期望x可能是文字false。我会将其切换为||=false,因为它具有相同的结果,但这在很大程度上取决于偏好。唯一的缺点是赋值会在每次运行

随机推荐