New answers tagged

0

please try this way fun mix(): Array<String?> { val cmdList = ArrayList<String>() var cmds: Array<String?>? = null try { cmdList.add("-y") cmdList.add("-ss") cmdList.add(startVideoDuration.toString()) cmdList.add("-t") cmdList....


0

6 years late to this answer, but VBScript can execute a command and store the output without relying on pipes or writing the output to temporary files. This function executes a command (without displaying a console window) and returns the output as an array: Function Execute_Command(sCmd) Dim i : i = 0 Dim oExec : Set oExec = CreateObject("...


1

You should be able to right-click "Private Queues" and then click Refresh. If this option has disappeared, you could use an alternate viewer: Mqueue viewver MSMQ QXplorer (old software but may still work)


0

Just to provide a solution to creating a different log file each day...you can just call robocopy in Powershell or batch command file and do your file manipulation and have it create the log, then rename the log file on the next line. The example below is PowerShell. Rename-Item -Path "C:\logs\robocopy.log" -NewName "robocopy-$(Get-Date -F ...


1

Perhaps your file is being run, and the problem is that it doesn't output a valid HTTP response? I'd fix that first, though I'm not sure if the file is being run or not. This is close to the minimal response: #!/usr/bin/env perl print "HTTP/1.1 200 OK\r\n"; print "Content-Type: text/plain\r\n"; print "\r\n"; print "test\r\...


0

rclone is an excellent solution that supports most remote filesystems including commercial options like box. Example rclone ls: rclone ls box:/somedir --include *.jpg If you run rclone on a remote headless computer there is an easy to use authentication mechanism in which you do a browser authentication on your local computer and copy a token to the remote ...


0

For anyone who wandered across this issue and didn't find the read-only flag to be the problem, I've stumbled across another fix for this. For my situation it seems that on WSL2 when veracrypt is mounted, WSL doesn't actually mount the filesystem. I realized this when I didn't see an entry in the mount command. You can mount it via: sudo mkdir -p /mnt/a sudo ...


0

cd C:\abc 7z x abc.zip -o* extracts abc.zip archives to sub folders with names of this archive which is abc.


0

I confirm DavidPostill's answer is effective. Another solution is to escape the "greater" sign in the SET command, using the "caret" symbol: set delay3=ping localhost -n 3 ^>nul It works the same way for "pipe" sign. Escaping specials characters can be handy in complex command lines, with combination of FOR, IF, FINDSTR ... ...


3

A pipeline takes the output of one command and uses it as the input to another command.  So there are two problems with what you tried. The cd command doesn’t produce any output1. file * doesn’t take any input.  You might say, “Of course it takes input; it reads (part of) all the files.”  But it doesn’t read standard input.  If you type file *, it just runs ...


0

What you are asking needs some preliminary work. From fonttools Merge multiple fonts into one (the text is bold in the source): All fonts must currently have TrueType outlines (glyf table). The fonttools project says in addition: The project includes the TTX tool, that can convert TrueType and OpenType fonts to and from an XML text format, which is also ...


1

I was able to get the result that (I guess) you want, sticking to CMD, but breaking your monster command into multiple steps, with an intermediate file: copy/y nul %temp%\out1.txt FOR /F "tokens=1 delims= " %P IN ('FINDSTR /M /I /R /C:"STATE.*=.*3" * ') DO (FINDSTR /I /S /C:"TCPHOST" %P) >> %temp%\out1.txt For /F "...


0

For more process info running in cmd,handle is the process id: wmic.exe path Win32_Process where handle='22792' get Commandline /format:list result: /path/to/app.exe [args specified goes here]


0

Not exactly a solution, but if you have CygWin installed, you just do (example for a 500000000 bytes file) : dd if=/dev/zero of=MyFile.zero bs=1 count=500000000 This is the same method you would use at any Unix-like operating system.


0

You can use the which command, and set the PATH variable just for the scope of that command. For example PATH="/path1:/path2" which "file1.txt" will return /path1/file1.txt if it exists, otherwise /path2/file1.txt if it exists.


0

For #3, Amplitude-Frequency plots, also called Bode plots, the libre software Audacity produces these under the name "Plot Spectrum..." a github project called WaveSpecter aims to tackle this from the command line.


1

cat file.sh | mongo … is UUOC, <file.sh mongo … is better. Side note: why .sh? It doesn't matter to mongo or whatever, but people will expect file.sh to be a shell script. From now on I'm using file1 instead. man 1 mongo gives an example: mongo script1.js script2.js script3.js, so I expect mongo … file1 to work as well. #!/path/to/mongo or #!/usr/bin/env ...


0

The answer was to go in Windows 10 > Recover > Open System Restore and follow the steps to rollback to the restore point. I was fortunate that there was a point backed-up as I thought I had disabled this behaviour.


1

General information The quoting in your code is very wrong. Important information: An unquoted variable undergoes word splitting and filename generation. Quotes that appear from variable expansion are not special to the shell that expanded the variable. There are two shells: the shell that interprets the script and the shell running in a container. Each ...


1

A solution I hadn't initially considered before I posted this question is to check the file exists before calling start, as follows: if exist example.exe ( start example.exe ) else ( echo Error: 'example.exe' does not exist 1>&2 ) Strictly speaking, not a direct answer to my question as I originally stated it, but nonetheless serves my ...


2

Yes it could be evidence of a virus or malware Yes you may be able to get back the command prompt by doing the following: Run powershell as admin Run the command sfc /scannow It will repair missing or corrupted system files.


1

A quick idea is to use Get-ChildItem with the -Directory and -Recurse options and use Start-Process and its -ArgumentList option to execute the python script passing it the full directory path. 1. Simple script (use to test specific folder(s)) $src = "C:\Folder\Path"; (Get-ChildItem $src -Directory -Recurse).FullName | % { Process { Start-...


0

ok... so I actually found a script someone wrote and took out a few things and it worked like a charm... $src = "G:\source\folder\" $dest = "Z:\destination\folder\" $src = $src.Replace("\","\\") $i = Get-ChildItem -Path $src -Recurse $i | % { ## -- All files and folders $apath = $_.FullName -Replace $src,&...


0

Yes. This is now possible as of Windows Terminal Preview v1.9.1445.0 while running the current Windows Insider Dev build of Windows 10 (OS build 21390.1010 for me at the time of writing). Be aware that the Dev channel is considered the least stable channel of Windows 10. You should also read the release notes for Windows Terminal Preview v1.9.1445.0 for ...


0

Same need here I was very interested by an answer since I was struggling and after some tries, here is an inelegant solution but it worked for me for /R %f in (*) do (echo "%~ff" >>"filename.txt" & ffprobe -i "%~ff" -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal >>"filename.txt&...


0

Because at the first install you don't have wget or brew, you can use curl, this works for me: curl https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg --output googlechrome.dmg


4

Objects under ~\AppData\Local\Microsoft\WindowsApps are not files – they are execution aliases, implemented through reparse points. They're a bit like symlinks or junctions, in that they they only point to another file within a specific application package, although they include some additional metadata about the package and they only support being executed ...


0

Powershell doesn't evaluate variables in strings enclosed by single quotes. Use double quotes instead, or if the variable contains the entire string you want to use, and only that, don't bother to quote it at all: $string_containing_filename_with_complete_path -replace $PSScriptRoot,""


0

Instead of using %~dp0 directly in the ROBOCOPY command, use ... pushd %~dp0 ROBOCOPY . "D:\Destination Folder" /E popd ... When I do that, the filename lines from ROBOCOPY look like e.g., 100% New File 800 Esperanto.ahk 100% New File 644 Sharp-S.ahk 100% New File ...


0

You can do this in Powershell using the following commands. Change keyboard to Arabic Set-WinUserLanguageList -LanguageList ar-eg, en-US -force Change keyboard to English: Set-WinUserLanguageList -LanguageList en-US, ar-EG -force


1

This answer is slightly misleading. check Kamil Maciorowski's comment. The easiest way to find out will be to use echo command. You can check what commands/programs receive after shell expansion. $ echo {} outputs: {} $ echo '{}' outputs: {} $ echo \{\} outputs {} so there is no real difference between them. one can use either way. In fact one can mix ...


1

Adding --v4l2-audio-mute should mute the sound on startup. From vlc --full-help: --v4l2-audio-mute, --no-v4l2-audio-mute Mute (default disabled) Mute the audio.


0

In an answer to a similar question unreliable results with -ss in earlier versions are mentioned. But in new builds it appears the same. To recap, if you use ss/to/t before -i, it cuts at i-frames, after -i, it cuts at specified times and uses the next i-frame till this frame is reached, i.e. you get a still picture to that time. At the time for -to it may ...


1

if your stuck after using sudo su as root: to exit use this command su -l <user_name>


0

In PowerShell either of the following commands will work Get-WmiObject win32_operatingsystem |% {$_.ConverttoDateTime($_.lastbootuptime)} (Get-CimInstance -ClassName win32_operatingsystem).lastbootuptime Get-CimInstance is both shorter and more future proof, because Get-WmiObject and wmic have been both deprecated You can also run (Get-WmiObject ...


0

Use quotes around file names that contain spaces scp -rv "C:\Users\User Name\Downloads\filename.c" username@path.edu:/home/student/username


0

I had the same desire to get a specific camera from the command line, so I could get a shortcut to view my video to work no matter which port I plugged into, etc.. the answers here helped, but didn't quite give me a full recipe, so I'll post a full solution. I have a usb camera I use for showing work I'm doing via a screen-share with my colleagues. I use VLC ...


1

A colleague and I found a powershell solution that requires no admin rights, and does not show any prompts. You can use the name of the font-file to install and uninstall. This makes it especially useful for scripting. I posted it over at stackoverflow: https://stackoverflow.com/a/67903796/1635906


1

It's hard to be specific without knowing what you are trying to do. Here is a code block that might get you started. get-childitem $HOME -recurse -filter "*.ps1" | group-object length | sort-object count -desc This illustrates using the -recurse and -filter parameters to get a lot of files with the same extension, in this case .ps1. It then ...


1

You can use this command: for /l %g in () do @( <your-command> & timeout /t 1 > nul ) This prevent the timeout command to write "Waiting for n seconds ..." so it's kind of silent.


2

You can also use sudo env PATH=$PATH ...rest_of_command_here.... Since that's not so convenient to type, I've added an alias alias sudop='sudo env PATH=$PATH'. The sudop (rather than aliasing sudo itself) is a reminder to me to make me aware that I am preserving my current environment path.


0

wt new-tab PowerShell -c Start-Service ; new-tab cmd /k ipconfig You can try it out, the simplest command is called in my example


1

Sorry for the late answer. Couldn't it be achieved with scheduled tasks ? Like create a scheduled task that runs once after reboot and launches the script where you want to resume it ?


0

While your example is pretty easy to convert to BAT, you will fail on Windows' bigges weakness: lack of tools. There's no tr, sed, grep, etc. Otherwise it's pretty straingforward. Echo doesn't need a replacement, cat is type, % is $ and so on, but as I said, yours won't work due to the lack of tools in Windows.


1

I have a folder which has many subfolders in it containing Word documents. I want to merge Word documents within a each folder and then merge the resulted merged documents created in each of folders into one large document. The below code is merging documents in a folder and when I perform a loop and add this above for loop to go in each subfolder and create ...


0

If you "protect" a sheet in Excel and use a password when you do that, this protection will follow the sheet if it is later copied or moved to another workbook. You don't need to do anything more.


2

.?* is not "a wildcard" in PowerShell. The -Replace operator in PowerShell doesn't use wildcard matching, it uses regular expressions. In regular expressions, . will match any single character except a line break. ? and *, as well as + are quantifiers used in conjuction with . or other, more specific, matching characters. So that: '.?' matches ...


1

I kept fiddling and worked it out: -replace 'foo=.*?.*', '' Adding the extra .* after the original wildcard made it work. OK now I have hours and hours of work to do ;)


0

I had the same issue and after a some trial and error found out that if I set --crop command line option to the aspect ratio of my display (in my case 4:3, and in your case 16:9, so cvlc --crop=16:9 video.mp4) the entire screen gets filled no matter what the resolution of the video is. Note that if you play 4:3 video file in this mode the top and bottom of ...


0

While the above answers where useful in helping me arrive at an answer to the question, they did not work as perhaps because they do not work on Windows (10) or VLC has since been updated to accept different switches. In particular, I will expand upon joctee's answer vlc -I dummy input.wav ":sout=#transcode{acodec=mpga,ab=192}:std{dst=output.mp3,access=...


Top 50 recent answers are included