标签: windows-console

Windows XP批处理文件concat

我正在努力完成以下荒谬的任务:

我有一个包含一组完全限定文件名的文本文件.我想迭代文件并将每一行追加到一个公共变量,该变量可以传递给命令行工具.例如,该文件可能是:

C:\目录\ test.txt的

C:\ WINDOWS \的test2.txt

C:\ text3.txt

我想把它们分配给一些变量'a',这样:

a = "C:\dir\test.txt C:\WINDOWS\test2.txt C:\text2.txt"
Run Code Online (Sandbox Code Playgroud)

第二个问题是 - 什么是好的批处理文件引用?我在Windows材料和许多本土网站中找到了一些东西,但没有什么特别完整的.

cmd concat batch-file text-files windows-console

1
推荐指数
1
解决办法
4083
查看次数

批量而不是阻止控制台

我想从Windows控制台(cmd.exe)运行程序,然后关闭控制台.现在当我这样做时,只要程序运行,控制台就会保持打开状态.

我想它启动程序,关闭控制台和使用程序.

我双击批处理

@c:\somedir\app.exe
Run Code Online (Sandbox Code Playgroud)

console windows-xp batch-file console-application windows-console

1
推荐指数
1
解决办法
1902
查看次数

在 Windows 7 中将当前时间和日期复制到剪贴板的命令

在 Windows 7 命令提示符下,我需要一个命令来将当前日期和时间复制到剪贴板。我用了

time /t & date /t | clip
Run Code Online (Sandbox Code Playgroud)

但它只复制日期而不是时间。我该怎么办?

clipboard piping windows-console

1
推荐指数
1
解决办法
3013
查看次数

如何在 Windows-10 上的 C 控制台程序中获取鼠标输入?

我需要在我的简单 C 控制台程序中与用户的鼠标输入进行交互。我做了一些研究,并在他们的页面上找到了相关的微软文档。首先,我复制了他们所有的示例代码并将其粘贴到我的编辑器中。编译后,它编译得很好,有一个漂亮的小“.exe”,运行时,正确地告诉/打印所有“按键事件”和“调整大小事件”,但没有鼠标事件!如何在C控制台程序中成功获取鼠标输入?我的MCVE是 Microsoft 网站上给定的示例代码,因为我逐字使用了该示例代码!我正在使用 Windows 10 Pro (1703),以防万一。


编辑: -这似乎不是我独有的问题。另一位 StackOverflow 用户也在他的 Windows-10 系统上报告了同样的问题他提供的 MCVE也适用于 Windows-7,但不适用于 Windows-10,就像我在 Microsoft 网站上引用的 MCVE 作为示例代码一样,可能适用于较旧的 Windows 版本,但不适用于 Windows-10,其中'似乎在“控制台默认值”中启用了“快速编辑模式”

c windows cmd windows-console windows-10

1
推荐指数
1
解决办法
3463
查看次数

selenium python 中无头 Chrome 的控制台警告和错误

我正在使用seleniumpython创建一个桌面应用程序..这个应用程序使用selenium从我的网站获取一些数据..它工作正常,没有任何问题,直到我尝试在无头模式下运行chrome ..像这样:

opt = Options()
opt.add_argument("--headless")
cpanel_window = webdriver.Chrome("chromedriver.exe", options=opt)
cpanel_window.get(mywebsite)
Run Code Online (Sandbox Code Playgroud)

它工作正常,但在控制台中一段时间​​后会出现奇怪的消息..

[1016/142332.539:INFO:CONSOLE(2)]“未捕获的类型错误:无法读取 null 的属性‘left’”,来源:https ://eaalim.examhelper.org/js/lavalamp.js (2)

[1016/142337.343:INFO:CONSOLE(0)]“混合内容:‘ https://eaalim.examhelper.org/cpanel/SendInvoice_1To1.aspx?coursecode=SB22496&back_sid=8969&back_g=All&back_type=s ’处的页面已通过 HTTPS 加载,但请求了不安全的图像“ http://eaalim.examhelper.org/emailtemplates/responsive/images/Icon-responsive.png ”。此内容也应通过 HTTPS 提供。”,来源:https://eaalim.examhelper .org/cpanel/fckeditor/editor/fckeditor.html?InstanceName=ctl00%24ContentPlaceHolder3%24txtemail&Toolbar=默认(0)

[1016/142337.344:INFO:CONSOLE(0)]“混合内容:‘ https://eaalim.examhelper.org/cpanel/SendInvoice_1To1.aspx?coursecode=SB22496&back_sid=8969&back_g=All&back_type=s ’处的页面已通过 HTTPS 加载,但请求了不安全的图像“ http://eaalim.examhelper.org/emailtemplates/responsive/images/logo.png ”。此内容也应通过 HTTPS 提供。”,来源: https: //eaalim.examhelper.org /cpanel/fckeditor/editor/fckeditor.html?InstanceName=ctl00%24ContentPlaceHolder3%24txtemail&Toolbar=默认

应用程序不会停止,但这些消息真的很烦人,因为我在控制台中打印步骤和报告,所以我需要它干净......有什么方法可以避免或隐藏这些消息吗?

python selenium console-application windows-console google-chrome-headless

1
推荐指数
1
解决办法
2575
查看次数

在与先前输入相同的行上打印文本

这本质上就是我想做的:

Write-Host "Enter username: " -NoNewLine
$username = Read-Host -NoNewLine
if ($username -eq "") {
    Write-Host "None"
}
Run Code Online (Sandbox Code Playgroud)

如果用户什么都不输入,那么这将是我想要的输出:Enter username: None

然而,我一直无法找到一种方法来读取用户输入而不生成新行,并且-NoNewLine不能与 Read-Host 一起使用。

windows terminal powershell windows-console

1
推荐指数
1
解决办法
363
查看次数

Python 2.7无法在Windows控制台中运行

我最近从python 2.6升级到python 2.7,每次我尝试todo,python setup.py install我得到.

'python' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)

它在2.6下运行良好.

python windows-console python-2.7

0
推荐指数
1
解决办法
161
查看次数

如何读取设置文件创建的连接字符串?

当我刚拿到app.config时,每当我尝试ConfigurationManager.AppSettings [0]或ConfigurationManager.AppSettings ["keyName"]时,我得到一个null.所以我尝试使用*.settings文件创建了一个看起来像这样的app.config

<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="IndexLoader.IndexLoader" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <applicationSettings>
    <IndexLoader.IndexLoader>
      <setting name="ConnectionString" serializeAs="String">
        <value>INITIAL CATALOG=xxx;DATA SOURCE=xxx;User ID=xxx;Password=xxx;Application Name=xxx;</value>
      </setting>
    </IndexLoader.IndexLoader>
  </applicationSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)

现在我如何使用C#读取此连接字符串?

该解决方案有多个项目,其中许多都有配置文件.有没有办法指定我想要使用代码项目中的配置文件?

c# config windows-console

0
推荐指数
1
解决办法
2万
查看次数

"Console ::"不编译

此代码取自http://msdn.microsoft.com/en-us/library/system.console.windowwidth.aspx 我想在gcc编译器中编译它.

#include<cstdio>
#include<string>
#include<windows.h>
#include<iostream>
using namespace System;
int main()
{
   int origWidth;
   int width;
   int origHeight;
   int height;
   String^ m1 = "The current window width is {0}, and the " 
   "current window height is {1}.";
   String^ m2 = "The new window width is {0}, and the new " 
   "window height is {1}.";
   String^ m4 = "  (Press any key to continue...)";

    // 
   // Step 1: Get the current window dimensions. 
   //
   origWidth = Console::WindowWidth;
   origHeight = Console::WindowHeight; …
Run Code Online (Sandbox Code Playgroud)

c++ msdn windows-console

0
推荐指数
1
解决办法
1190
查看次数

如何将c#help集成到控制台应用程序中

背景信息(基于我的第一个问题):我想在我的"GUI.exe"(用c#编写)中集成一个帮助功能.然后当我想在我的cmd中启动 - >"GUI.exe --h"的帮助功能.

尝试了stackoverflow-帖子:我尝试使用这个解决方案:在C#控制台应用程序中添加"--help"参数.

static bool ShowHelpRequired(IEnumerable<string> args)
{
    return args.Select(s => s.ToLowerInvariant())
        .Intersect(new[] { "help", "/?", "--help", "-help", "-h" }).Any();
}
Run Code Online (Sandbox Code Playgroud)

目前的问题:

我不知道在哪里可以集成帮助功能.我不知道我的Microsoft Visual Studio中的特定设置是否必须配置.

提前感谢您的支持.

c# integration cmd windows-console

0
推荐指数
1
解决办法
278
查看次数

通过 .py 脚本执行的 .exe 文件隐藏控制台窗口

我试图隐藏从 EXE 文件弹出的控制台窗口。我正在从我自己的 EXE(通过 PyInstaller 冻结的 Python 脚本)运行这个 EXE。

我发现,每当我通过 IDLE 或 PyCharm 运行脚本时,我都可以隐藏控制台窗口,并且一切正常。但是,如果我将脚本转换为 EXE(使用pyinstaller --onefile),则它不起作用。

我尝试了几乎所有 Google 和 SO 对我对这个问题的搜索的响应,但我仍然不知道如果我将脚本转换为 EXE 文件并运行它,我该如何隐藏控制台窗口。

我试过的最后一个:

import subprocess
import win32gui
import time

proc = subprocess.Popen(["MyExe.exe"])
# lets wait a bit to app to start
time.sleep(3)

def enumWindowFunc(hwnd, windowList):
    """ win32gui.EnumWindows() callback """
    text = win32gui.GetWindowText(hwnd)
    className = win32gui.GetClassName(hwnd)
    #print hwnd, text, className
    if text.find("MyExe.exe") >= 0:
        windowList.append((hwnd, text, className))

myWindows = []
# enumerate thru all top windows and get …
Run Code Online (Sandbox Code Playgroud)

python windows windows-console python-3.5

0
推荐指数
1
解决办法
5156
查看次数

方括号前的 L"string" 是什么意思?

我在一个据称微不足道的俄罗斯方块控制台游戏代码中发现了这一点。

wchar_t *screen = new wchar_t[];
unsigned char *pField;
.
.
.
screen[someMathIndex] = L" ABCDEFG=#"[pField[someOtherMathIndex]];
Run Code Online (Sandbox Code Playgroud)

方括号前面的 wchar 字符串是什么意思?我什至无法找到一种方法来谷歌它。你能不能把我重定向到这个奇怪的东西的一些资源。

c++ windows-console

0
推荐指数
1
解决办法
60
查看次数

在 C 中为 win32 和 win64 打开 stdin/stdout/stderr 的 Windows 控制台

首先,我不是Windows程序员(甚至不是Windows用户),我在Linux上使用交叉编译器也为Win32和Win64构建。在挖掘网络之后(甚至在这里提出一个问题),我设法将一个代码片段放在一起,它可以打开一个 Windows 控制台,并将其用于 stdin/stdout/stderr。它在 Win32 上运行良好,但在 Win64 上程序崩溃。我猜问题是不同的长整型数据类型大小,gcc 甚至对此发出警告。然而,由于我不知道某些 Windows API 类型的确切用途和大小,所以我不知道应该更改什么。当然,最好的办法是一些独立于 win32/win64 的解决方案。我还尝试对 lStdHandle 使用“HANDLE”类型,但它甚至无法编译。有人能帮忙解决这个问题吗?

    int hConHandle;
    long lStdHandle;
    //HANDLE lStdHandle;
    CONSOLE_SCREEN_BUFFER_INFO coninfo;
    FILE *fp;
    FreeConsole(); // be sure to release possible already allocated console
    if (!AllocConsole()) {
            ERROR_WINDOW("Cannot allocate windows console!");
            return;
    }
    SetConsoleTitle("My Nice Console");
    // set the screen buffer to be big enough to let us scroll text
    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
    coninfo.dwSize.Y = 1024;
    //coninfo.dwSize.X = 100;
    SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
    // redirect unbuffered STDOUT to the console
    lStdHandle …
Run Code Online (Sandbox Code Playgroud)

c windows win64 windows-console

-1
推荐指数
1
解决办法
2735
查看次数