24,382 questions
-6
votes
0
answers
67
views
Cmd: Nonsense in "For /F"-Loop on (Win11 [closed]
This is the beginning of my project.
And I ran into many problems faster than expected — problems that no AI could help me with, I know of the moment.
Just ignore the fact that it was written for ...
-3
votes
0
answers
115
views
Why does VS Code’s external console (cmd.exe) echo my input when running a C++ program and how to change [closed]
My code:
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin ...
1
vote
4
answers
156
views
How to get from a url string the path to a file with a FOR loop in a Windows batch file?
Given is a string which is a url of a file, e.g. http://url.com/file.zip. I want to extract the path without the file name, i.e. http://url.com/.
My idea for doing this was to break down the string ...
0
votes
2
answers
167
views
How to accurately extract a block of text with CMD BATCH?
I'm trying to output part of a file (the text enclosed between :begin(...) and :end(...) markers) using a BATCH script. The target is pure ASCII text but it may contain blank lines and symbols; the ...
1
vote
1
answer
114
views
How to split a long powershell -Command "Powershell code to execute" line in cmd so both cmd and Powershell is happy? [duplicate]
I am using the following code to start putty according to the current COM name:
powershell -Command "$COMPORT=(Get-WmiObject Win32_SerialPort | Select-Object Name, DeviceID | Where-Object { $_....
0
votes
4
answers
159
views
How to write a batch file that processes a maximum number of files concurrently
I have a folder that contains 1000 .wav files on a Windows 7 system.
I have fdkaac.exe in the system environment path.
If I run the following batch file:
for %%i in (*.wav) do fdkaac.exe -b256 -w20000 ...
2
votes
1
answer
93
views
Run chrome from cmd with script and complex url
I want to run Chrome with js script and url which contains fragment, like this:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --app="data:text/html,<html><body><...
2
votes
1
answer
746
views
I'm unable to run my flutter app on emulator in vscode. Says unsupported emulator
I am new to flutter. I have flutter installed, and I installed an emulator image using sdkmanager and also installed an emulator in vscode. I am able to launch the emulator but when I try to run my ...
-1
votes
1
answer
72
views
Qt's Qprocess to run CMD gives error of DOSKEY
I am using Qt6.5
I have a button on my UI. When clicking on the button, I want to run a command in CMD. Below is my code when clicking:
QString output, error;
QProcess process;
process.start("cmd&...
2
votes
4
answers
201
views
How to write a line feed <LF> to a file?
The following Windows batch file sets the contents of the out.txt file to two ASCII characters, namely: X and <LF> (0x58 and 0x0A ).
@echo off
SETLOCAL
SET LF=^
set /p=X^%LF%%LF%<nul>out....
2
votes
1
answer
103
views
How to convert cmd pipe to powershell in context of binary data (ffmpeg and streamlink)
I'd like to convert a pipe of video stream between streamlink and ffmpeg from cmd to Powershell. But from what I searched powershell only supports piping objects.
Is there any way to reproduce this in ...
2
votes
1
answer
108
views
cmd batch execution adds a space after echo
When I run a script, for example one that says
echo a>>1.txt
the command line interpreter adds a space; so in the command line, executing the above says
echo a 1>> 1.txt
And of course, ...
4
votes
1
answer
185
views
`%~dp0` doesn't always return the current directory [duplicate]
I put Daily Test Run.bat inside E:\Test folder. This is the content of the bat file:
@echo off
cd /d "%~dp0"
echo %~dp0
cd /d E:\Dev
cd /d "%~dp0"
echo %~dp0
Then I cd to E:\...
5
votes
1
answer
208
views
How does Rust's Command handle cmd.exe and batch script arguments?
A while ago there was a security advisory published for Rust that the standard library's Command API was not sufficiently handling arguments passed to cmd.exe and .bat files such that malicious ...
1
vote
1
answer
48
views
Why cannot assign a window title to a background python process
I have a very simple python script inifinity_loop.py:
import time
i = 0
interval = 5
while True:
print(f'I am counting {i} seconds')
time.sleep(interval)
i += interval
and I want to ...
1
vote
2
answers
107
views
Still receiving Invalid Argument Errno::EINVAL with STDIN.gets.chomp and $stdin.gets.chomp - Windows 10
I've never written or read any ruby code in my life until today - this said - I've been tasked with solving an input problem. In the short amount of reading I've done, I've found that @vars are ...
2
votes
2
answers
84
views
Findstr will not redirect to file
-> I want to find this string in the text file
flashwareFileName="FL_992920900X_0143__V001_S.pdx"
Attempts:
findstr /s "=\"FL_" *.xml > temp.txt
findstr /s "=FL_&...
2
votes
2
answers
292
views
How to get the file's MD5 Hash in windows?
How do I get the file's md5 hash in windows using the command line? I only want the raw MD5 hash without all the extra text. I tried asking chatgpt but it gave me half working command.
for /f "...
0
votes
2
answers
118
views
How to print text to the area where you enter CMD prompts in C++?
Apologies if this is an odd way of phrasing the question, but I mean printing text here for the user to edit:
Essentially, I'm trying to make a program using C++ where the user can edit pre-existing ...
1
vote
0
answers
105
views
Using fnm on Windows CMD: "failed printing to stdout: The pipe is being closed" Error
I'm trying to set up Node.js using fnm on my Windows machine (using the Command Prompt). I installed fnm via winget and then installed Node.js version 22 with the following commands:
winget install ...
-1
votes
2
answers
91
views
Why does an environment variable reference expand always to 1 on repeated batch execution?
Task description
Prompt the user to enter their age in years, save the users response
as a variable age.
If the user did not provide a response like an
empty string or letters or characters echo a ...
2
votes
2
answers
179
views
How to check if a string contains a substring in batch
There was a question asked here with the same title, but I don't understand what it was talking about.
All I'm trying to do is see if the end-user is putting in vaguelly the same text. This will also ...
0
votes
1
answer
526
views
How do I eliminate or ignore the %command% from a Steam game launch option?
I'd like to launch an unrelated program from Steam, so that Steam shows me as playing that game even though I'm not. Specifically I'd like to open a browser and have Steam show me playing a game while ...
0
votes
1
answer
145
views
How to use GITHUB_ENV in GitHub Actions with Windows cmd (Command line prompt)
For anyone using 'cmd' instead of 'pwsh' (such as me)
How do you use the GITHUB_ENV to set/store environment variables persistently between steps
1
vote
1
answer
93
views
The CMD command to extract username, group name, and permissions from manually created users and not inbuilt is showing a FindSTR: cannot open error
I have installed Windows 2012 server Core only so I can only use command prompt. I created certain users in groups and given them permissions to write, read, delete etc. Now I wish to use the cmd to ...