我想知道是否有任何方法可以隐藏关闭按钮,或者至少在控制台中使用Perl时使其无法点击.我知道使用GUI时有可能,但我需要创建一个基于控制台的应用程序,并且不希望用户故意关闭它.
代码:
该程序检查输入的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) 我正在编写应该使用 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) 微软Windows提供了多种功能来查询当前的代码页:
GetACP,GetConsoleOutputCP,GetConsoleCP.
它们返回不同的值.例如,我的机器上,GetACP返回1252,而GetConsoleOutputCP与GetConsoleCP返回437.
(我们也可以chcp在命令行上运行并获得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
我想弄清楚如何让我的程序在全屏控制台窗口中打开。
是否可以在命令提示符中键入任何命令来切换全屏?
如果是这样,我会想象代码是这样的:
from os import system
system("toggle.fullscreen")
{CODE HERE}
Run Code Online (Sandbox Code Playgroud)
我知道可以使用模式 con,但这实际上并没有切换它被最大化,这对我来说会更有用,谢谢!
我正在尝试在使用的 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 脚本的建议。我还是新手,自己学的。我在谷歌上找到了脚本。重新输入后,它不会在控制台中打印结果。脚本的结果如何显示在控制台中?详情如下:
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) 我有一个问题.当我运行命令时:
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
我有一个简单的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) 当我们使用pause它时显示"按任意键继续......".按任意键后,后一个文本保留,剩下的文本显示在其下方.如果我cls在pause整个屏幕被清除后使用.
是否有任何方法只能删除"按任意键继续......" 按任意键后?另外,如何仅清除选定的行而不是清除整个屏幕?
windows-console ×10
windows ×4
python ×3
batch-file ×2
cmd ×2
c ×1
c# ×1
codepages ×1
curl ×1
cursor ×1
ffmpeg ×1
git-bash ×1
perl ×1
powershell ×1
pyinstaller ×1
subprocess ×1