标签: windows-console

Perl控制台窗口 - 如何使其不可关闭?

我想知道是否有任何方法可以隐藏关闭按钮,或者至少在控制台中使用Perl时使其无法点击.我知道使用GUI时有可能,但我需要创建一个基于控制台的应用程序,并且不希望用户故意关闭它.

windows perl windows-console

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

控制台窗口的输出是否有限制?

代码:
该程序检查输入的2个数字是否可以被数字2 - 9整除,并显示剩余的可分数(不包括被查看的数字).

static void Main(string[] args)
{
    for (int i = 2; i < 10; i++)
    {
        Challenge(2, 6, i);
    }
    Console.ReadLine();
}

static void Challenge(int num1, int num2, int Divisor)
{
    int sum = num1 + num2;
    bool SumDivisible = sum % Divisor == 0;
    bool num1Divisible = num1 % Divisor == 0;
    bool num2Divisible = num2 % Divisor == 0;

    int highNum = 80;
    List<int> NumbersDivisible = Enumerable.Range(1, highNum).Where(x => x % Divisor == 0).ToList();

    // …
Run Code Online (Sandbox Code Playgroud)

c# windows-console

3
推荐指数
2
解决办法
4132
查看次数

如何从 Windows 批处理脚本通过 curl 发送带有 json 正文的 POST 请求

我正在编写应该使用 json 发送请求的批处理脚本。

call curl -X POST -H 'Content-type: application/json' --data '{"text": "Pull requests:\n%linksText% has been deployed to %stagingServerUrl%", "username": "Staging Server"}' http://requestb.in/ovehwtov
Run Code Online (Sandbox Code Playgroud)

我从 git bash 运行我的脚本,虽然它发送了请求,但正文格式不正确,就在它发送请求之前,我在控制台中看到错误:

curl: (6) Couldn't resolve host 'application'
curl: (6) Couldn't resolve host '"Pull'
curl: (6) Couldn't resolve host 'requests:\nhttp'
curl: (6) Couldn't resolve host 'has'
curl: (6) Couldn't resolve host 'been'
curl: (6) Couldn't resolve host 'deployed'
curl: (6) Couldn't resolve host 'to'
curl: (6) Couldn't resolve host 'unicorns2url",'
curl: (6) Couldn't resolve host …
Run Code Online (Sandbox Code Playgroud)

curl cmd batch-file windows-console git-bash

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

为什么ANSI代码页和控制台代码页有所不同?

微软Windows提供了多种功能来查询当前的代码页: GetACP,GetConsoleOutputCP,GetConsoleCP.

它们返回不同的值.例如,我的机器上,GetACP返回1252,而GetConsoleOutputCPGetConsoleCP返回437.

(我们也可以chcp在命令行上运行并获得437)

  • 为什么Windows为控制台和非控制台提供不同的代码页?
  • 这些代码页如何根据机器确定?
  • 同一台机器上的代码页之间有什么关系?控制台和非控制台代码页之间是否存在关联?代码页1252的机器是否总是有437的控制台代码页?

此问题的背景是来自Visual Studio C++的错误消息:

error C2855: command-line option '/source-charset' inconsistent with precompiled header
error C2855: command-line option '/execution-charset' inconsistent with precompiled header
Run Code Online (Sandbox Code Playgroud)

当使用与使用它们的CPP文件(由于某种原因)不同的默认代码页构建预编译头文件时,会发生这些错误.
来自MSDN文档:

如果未找到字节顺序标记,则假定使用当前用户代码页对源文件进行编码,除非您使用/ source-charset选项指定字符集名称或代码页.

所以我试图找出他们引用的代码页,返回的代码页GetACP或其他代码页......

windows codepages visual-studio windows-console visual-studio-2015

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

Python控制台全屏?也许使用 os.system?

我想弄清楚如何让我的程序在全屏控制台窗口中打开。

是否可以在命令提示符中键入任何命令来切换全屏?

如果是这样,我会想象代码是这样的:

from os import system

system("toggle.fullscreen")

{CODE HERE}
Run Code Online (Sandbox Code Playgroud)

我知道可以使用模式 con,但这实际上并没有切换它被最大化,这对我来说会更有用,谢谢!

python windows windows-console

3
推荐指数
2
解决办法
7484
查看次数

在 python 窗口(Tkinter)应用程序中抑制子进程控制台输出

我正在尝试在使用的 python 应用程序可执行文件中运行以下代码

pyinstaller -w -F 脚本.py

def ffmpeg_command(sec):
    cmd1 = ['ffmpeg', '-f','gdigrab','-framerate',config.get('FFMPEG_Settings','Framerate'),'-i','desktop',gen_filename_from_timestamp_and_extension()]


    proc = subprocess.Popen(cmd1,stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

    duration = sec
    sleeptime = 0
    while proc.poll() is None and sleeptime < duration: 
        # Wait for the specific duration or for the process to finish
        time.sleep(1)
        sleeptime += 1

    proc.terminate()
Run Code Online (Sandbox Code Playgroud)

当按下 Tkinter 按钮时运行上面的代码,并且从按钮单击处理程序调用此代码。

我的问题是,当我运行 exe 时,它​​不会运行 ffmpeg。但是,如果我将命令设置为:

proc = subprocess.Popen(cmd1)
Run Code Online (Sandbox Code Playgroud)

FFMPEG 确实运行了,我得到了我想要的电影文件,但我可以看到 FFMPEG 的控制台窗口。所以我最终在我的电影中获得了控制台窗口。(我负责最小化按钮单击处理程序中的 Tkinter 窗口)

我的问题是如何抑制控制台窗口并仍然让 FFMPEG 以我想要的方式运行?我看着下面的线程,但不能使它工作: 如何子的隐藏输出在Python 2.7打开一个程序与Python最小化或隐藏

谢谢

python subprocess ffmpeg pyinstaller windows-console

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

Python 脚本不会在命令提示符中打印输出

我需要一些关于 Python 脚本的建议。我还是新手,自己学的。我在谷歌上找到了脚本。重新输入后,它不会在控制台中打印结果。脚本的结果如何显示在控制台中?详情如下:

C:\Python27>test1.py af8978b1797b72acfff9595a5a2a373ec3d9106d

C:\Python27>

我按回车后,没有任何反应。结果应该显示还是不显示?

这是我重新输入的代码:

#!/usr/bin/python
#coding: ascii

import requests
import sys
import re

url = 'http://hashtoolkit.com/reverse-hash?hash='
try:
    hash = sys.argv[1]
except:
     print ("usage: python "+sys.argv[0]+" hash")
sys.exit()

http = request.get(url+hash)
content = http.content
cracked = re.findall("<span title=\*decrypted (md5|sha1|sha384|sha512) hash\*>(.*)</span>", content) # expression regular
print ("\n\tAlgoritmo: "+cracked[0][0])
print ("\tPassword Cracked: "+cracked[0][1])
Run Code Online (Sandbox Code Playgroud)

python windows-console

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

Get-Content的PowerShell问题

我有一个问题.当我运行命令时:

powershell -command"gc C:\ Program Files\Microsoft SQLServer\MSSQL.1\MSSQL\LOG\ERRORLOG -totalcount 5

有一个错误:

"Get-Content:找不到接受参数'Files\Microsoft'的位置参数.在行:1 char:3 + gc <<<< C:\ Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG -to talcount 5 + CategoryInfo:InvalidArgument :( :) [Get-Content],ParameterBindingException + FullyQualifiedErrorId:PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetContentCommand"

你能帮帮我吗?

windows powershell remote-access file-get-contents windows-console

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

如何在c中隐藏控制台光标?

我有一个简单的C程序,表示控制台内的加载屏幕,但无法隐藏光标。我尝试提高睡眠功能的速度,以便重置游标计时器并且游标消失,但这不起作用。

有关如何隐藏光标的任何提示。

码:

#include <stdio.h>
#include <stdlib.h>

const int TIME = 1;

int main(int argc,char *argv[]){
    int i;
    while (1){
        printf("loading");
        for (i=0;i<3;i++){
            sleep(TIME);
            printf(".");
        }
        sleep(TIME);
        printf("\r");
        system("Cls");
        sleep(TIME);
    }
}
Run Code Online (Sandbox Code Playgroud)

c cursor windows-console

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

如何清除批处理中的选定行而不是整个屏幕?

当我们使用pause它时显示"按任意键继续......".按任意键后,后一个文本保留,剩下的文本显示在其下方.如果我clspause整个屏幕被清除后使用.

是否有任何方法只能删除"按任意键继续......" 按任意键后?另外,如何仅清除选定的行而不是清除整个屏幕?

cmd batch-file windows-console

2
推荐指数
2
解决办法
840
查看次数