All Questions
Tagged with command-line powershell
846
questions
0
votes
1
answer
58
views
How to solve a final pb when merging a series of .ts file with concat command of FFmpeg?
I had dowloaded some videos from the Internet, feaw years ago…
I obtained many files: a series of files in .ts
In my example: a series of 306 files named from segment1_4_av.ts to segment306_4_av.ts
A ...
2
votes
1
answer
56
views
Trying to capture same functionality in Windows cmd prompts as in a PowerShell list of commands using net localgroup
I work in an environment with a mix of older and newer Windows components on isolated networks. To try and make a certain task easier, I worked on a list of PowerShell commands to create a single text ...
0
votes
0
answers
24
views
Explore Regedit.exe to the specified address from the CommandLine [duplicate]
Generally, when we want to navigate to one of the registry addresses, we open regedit.exe then copy-paste the address into address bar, then press enter.
For example Computer\HKEY_CURRENT_USER\Console
...
0
votes
0
answers
33
views
Task scheduler program script psexec where executed program need argument parameter too
So I have psexec64 to run a program as system user. The program is SyncToyCmd:
Here is it sucessfully on previleged powershell:
PS C:\Users\User> where psexec64
PS C:\Users\User> gcm psexec64
...
0
votes
2
answers
227
views
Reset Windows Update settings back to default, including respective local policy, by command-line only?
I have many Windows 10 and Windows 11 machines, which are in different states of windows update settings. Unfortunately, some machines have local policies active for windows update settings.
I need to ...
0
votes
1
answer
69
views
What privilege is required by the caller to invoke the -ExecutionPolicy parameter of Powershell 7.x
When invoking Powershell directly by invoking PWSH.EXE, it accepts an -ExecutionPolicy parameter for essentially a "one time/this-instance-only" invocation with something other than the ...
0
votes
0
answers
51
views
Conversion of url to pdf using chrome command line
I am using this code in powershell to convert url to pdf start chrome -ArgumentList "--headless --print-to-pdf=C:\Users\user\Desktop\file1.pdf link but it is not providing any css.
Is there any ...
1
vote
3
answers
167
views
Powershell - keep only lines in txt files contain some selected words
I have a txt file and I would like to keep only a few lines in it
I want to a command that turns this
txt file:
;FFMETADATA1
title=TNT
disc=01
comment=
lyrics-eng=
\
\
\
album=Classic
genre=Older
...
0
votes
1
answer
53
views
How to delete directory called [ '.. ]
I am amazed by the things Windows lets you do, then doesn't let you undo.
Doing some programming, I ran a build script and specified the output folder as '../my/folder'
From this, it created a folder ...
2
votes
1
answer
91
views
Exporting excel data with powershell for robocopy
I have on my hand a 300 lines excel sheet with source path and destpath for robocopy, to avoid copy paste all the path on a .bat file I try to make this powershell script:
# Import the Excel module
...
1
vote
0
answers
372
views
How do I add a user with "Full Control" permissions to folder without changing owner of the folder (I.E.) Administrators, using the command line?
I want a command-line solution to add a local user account to the permissions table for a directory and grant the account full access... WITHOUT changing the ownership of the directory.
I'm looking ...
0
votes
1
answer
87
views
Modify Windows CommandLine StartUp Text
I want to replace both text Powershell Startup and CMD StartUp below
# PowerShell
PS C:\Users\Admin>
# CMD
C:\Users\Admin>
with
PS >
CMD >
Like Python Start Up that only showing >>...
0
votes
2
answers
75
views
Getting Two Character Variable Without Pressing Enter (PowerShell/ CMD)
Bash Script:
#! /bin/bash
read -n 2 -p '2 digit:' ans;
echo $ans
When i finish input two character, the script continue, without waiting me to press enter.
And what I have pressed saves to the ...
6
votes
2
answers
742
views
Are there commands in PowerShell 7 to split the current window into four and request to run Python files in each of them?
Currently, I click + 3x while holding Alt to create four divided terminals within the same tab:
In each of these, I need to run a different Python commnd:
cd "C:\Users\Computador\Desktop\Test ...
3
votes
2
answers
406
views
What Equivalent %* of Batch in PowerShell
Batch Script:
@echo off
if not "!!"=="" setlocal enabledelayedexpansion
for /f "tokens=4*" %%a in (
'dir /AD "%USERPROFILE%\" ^| find "DIR" ^| Find /...
0
votes
1
answer
90
views
How to open the CMD or the PowerShell in the Windows terminal when you open them as Admin?
I noticed that when I open the CMD or the PowerShell in non-admin mode, it always opens in the terminal; however, when I open the CMD or the PowerShell as admin, it always opens the old window. Indeed,...
0
votes
1
answer
119
views
CMD/Powershell looking for "curl" executable in the wrong location despite PATH
I have a strange issue with both CMD and Powershell on Windows 10 that has been giving me some trouble. An unrelated scriptwas failing when running curl, and after some investigation it looks like a ...
-1
votes
3
answers
105
views
How do I delete files with "- copy" in the name using wildcards?
I have a problem, which appears that How to delete files with specified text in their names? would delete what I don't want deleted.
Because of an issue with OneDrive after installing an extra ...
0
votes
1
answer
303
views
How do I make a command line always show in front of another app
let's say I only have one monitor and I open an IDE and a powershell window. I need to type words in the IDE's current tab while watching the conent of the command line.
The problem I have is, ...
0
votes
4
answers
156
views
How to auto power on windows laptop when lid is opened from shutdown state just like hibernation state?
It has been observed that most laptops power back on by themselves upon reopening the lid if they were in hibernation mode.
However, this behavior is not replicated when the laptop was in full shut ...
0
votes
1
answer
265
views
What secure erase in the fastest way on Windows 10 with cmd? [duplicate]
I have a program in QT, C++ and I want to secure erase the computer after a trigger. After this process, I do not want the old data on the SSD to be accessed by data recovery programs. I want this ...
-1
votes
1
answer
134
views
Uninstall SourceTree using cmd or powershell
I would like to use cmd or powershell commands to uninstall SourceTree from windows 10 machines on my network. The reason I need a terminal way is that I have to do this remotely and simultaneously ...
0
votes
1
answer
88
views
Errors while reading policies from this GPO, not all policies are displayed
I am working on implementing an automatic Quality of Service (QoS) policy creator using the "New-NetQosPolicy" PowerShell command. I have a C++ script that executes this command to limit the ...
1
vote
2
answers
198
views
Copy single file in to sub folders of destination root folder
I need to copy a single text file inside a (source) folder in to all (480) sub folders of another parent folder.
To keep it simple (I will amend the correct paths later) as I try to work out how to do ...
0
votes
0
answers
402
views
Powershell prompt freezes
On several boxes with Windows 10 or 11, the PowerShell command prompt regularly freezes For several seconds during a session, at times 30 seconds or more.
The keyword buffer works ok, but after ...
1
vote
1
answer
73
views
Restart the process if its output unchanged in PowerShell
I have this command
for ($i=0; $i -gt -1; $i++) {
$path = "..."
ffmpeg -f dshow -i audio="Microphone (USB Microphone)" -y -t 00:10:00 -b:a 128k $path
}
I need to get the ...
2
votes
2
answers
387
views
Powershell (windows 11) move files and rename
I am trying to write PowerShell that will allow me to clean up files and place them into folders and rename them to include a date in the filename, and once I work out the commands, I will script it.
...
0
votes
0
answers
178
views
List all Volumes of an SMB share on Windows
I have enabled SMB sharing on a MacBook Pro with an IP address 192.168.128.29. On another MacBook Pro, I can connect to server with smb://192.168.128.29/ and after providing the username and password,...
0
votes
1
answer
70
views
Windows 11, How to have 2 outputs with 1 command?
Windows 11 command prompt:
Output1:
This command chkdsk /r d: works fine and
outputs data to screen.
But how much time does above command take?
ran second command and Answer was
6 hour 12 minutes ... ...
0
votes
1
answer
95
views
Open shell of container when write start command
When i want to open shell of container when start container i get this error
I use this command :
docker start -i <Container name> sh
but get this error :
you cannot start and attach multiple ...
0
votes
1
answer
195
views
Python Can Run with Typing "python.exe" Rather Typing "python"
I have added python to env on PATH correctly C:\Users\username\AppData\Local\Programs\Python\Python38\
But now I need to type python.exe to start it rather than typing python like before
And it will ...
3
votes
0
answers
2k
views
PowerShell - Cannot uninstall the Microsoft.HEIFImageExtension on several Win10 systems
I have a PowerShell command line to uninstall the HEIF image extension component provided by default on Win10/Win11 OS. This command is the following:
get-appxpackage Microsoft.HEIFImageExtension -...
2
votes
1
answer
500
views
How cmd get arguments list
I have a file a.cmd. Path to the file is C:\Program Files\a\a.cmd and C:\Program Files\a is in PATH environment variable.
When I invoke a.cmd from PowerShell (v. 7.2) I see that a process with the ...
1
vote
1
answer
614
views
How do I change the background color for folders in PowerShell when invoking the "ls" command from WSL Interop?
I've installed the WslInterop module and exposed several commands from WSL2.
I'm using Import-WslCommand "apt", "cat", "awk", "nano", "find", "...
0
votes
1
answer
1k
views
Powershell - Read Text File and Create a New File based on each line of the text file
I am trying to create a new filename based upon the content of an existing text file. For example,
FileNameList.txt
===============
Places to Visit
Things to Take
Things to do in Home Before Leaving
# ...
0
votes
2
answers
1k
views
Run Powershell command from cmd with parameters
I intend to run the following command from a cmd shell
git clone $(Get-Clipboard)
From the context menu in Explorer.
How would I run such from a command shell? What doesnn't work is
PowerShell -...
1
vote
1
answer
173
views
What is the equivalent of Linux's && for windows
What is the equivalent of Linux's && for windows
For example
cd\
cd rcA
powershell "ls | where {$_.Length -lt 100gb} | Remove-Item -Force -Recurse"
What to add to make the script ...
0
votes
0
answers
312
views
Powershell Core can't execute Cmdlet that Powershell can
When I try to execute Resolve-DnsName google.de in a Powershell Core (Version 7.3.5) I get the error
Resolve-DnsName: The 'Resolve-DnsName' command was found in the module 'DnsClient', but the module ...
0
votes
1
answer
736
views
How do you set the target and not the target path of a .lnk file programmatically with powershell or c++?
How do you set the target and NOT the targetPath of a .lnk file
?
I can't find any .dll I can use in powershell or c#.
Most people might try and tell to use wshshell to set the .targetpath of the .lnk ...
-1
votes
1
answer
165
views
Command Prompt Drive Switching Different From PowerShell [closed]
In Command Prompt, I can switch from the C:\ drive to the D:\ drive with the following (rather simplistic) command:
D:
I can also switch between different directories in the same drive with the cd ...
1
vote
0
answers
118
views
Messed up Windows .ps1 file, and now can't open CMD or run any commands in Powershell
At some point, I created a startup file for cmd and powershell. Ending in .ps1 I think. I must have a typo in it or something because I now get this error in powershell when trying to run commands:
&...
0
votes
0
answers
37
views
Batch Move-Item operation only working on a fraction of the items [duplicate]
I am trying to move all directories which contain a file named '√.txt' to a separate directory, with the following line of code:
Get-ChildItem -Path D:\music -Recurse -Filter √.txt |
Select-Object -...
3
votes
1
answer
3k
views
How can I change my PowerShell commands' output to have different colors?
How can I change my PowerShell commands to look like Windows development setup with WSL2, ZSH, VSCode, and more? You can check at timestamp: 3:55, also refer this image:
I had installed the xcad ...
1
vote
0
answers
298
views
Copying Specific Subfolder from Multiple Top Level Folders to a Network Path
I have multiple top level folders (about 30) with one particular subfolder I need to copy to another network path (Windows10).
I am trying to see if there is a script or PowerShell command that will ...
0
votes
2
answers
100
views
From a path, all files, including those stored in subfolders, but not the subfolder-structures themselves, only the files, are to be copied?
From path Y:\Server-MODS all files including those which are stored in subfolders, but not the subfolders themselves, but really only the files themselves are to be copied to the following path via ...
4
votes
1
answer
37k
views
Set folder permissions through CMD - MS Windows
I need to write a small Windows software (using VisualBasic PL) to create automatically folder trees, following a fixed structure; in particular, I have to create the main folder with several ...
0
votes
1
answer
1k
views
Is it possible to run CrystalDiskInfo from the command line/powershell?
I want to be able to run CrystalDiskInfo from the cmd to save and analyze the data. I want to do it in a way where I can automatically run CrystalDiskInfo on a remote device and send commands based on ...
0
votes
2
answers
467
views
Recursive directory rename with subfolder level control
My Challenge: Recursively renaming the 3rd subfolder {subf3} and beyond {subf4, 5, 6, ...} of a root path to keep only the first 4 characters of their original folder name.
e:\ {rootf} \ {subf1} \ {...
2
votes
1
answer
1k
views
How to find public ip address in PowerShell from a restricted internet in windows 11
How to find public ip address of a windows 11 pc using powershell or command prompt.
Tried ipconfig and gip(powershell) both of them shows different ip compared to ip from the browser.
IPv4 displayed ...
1
vote
1
answer
1k
views
Removing mail accounts from local Windows users via CLI
I am looking for a way to remove linked mail accounts from a local Windows user via a script from the command line, or another way I can reliably schedule.
I'm not talking about a Microsoft account, I'...