Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

How to change file path in BAT file based on the current user? [duplicate]

I am new to batch scripting so please offer constructive advice on how to approach the task. I have a bat file to run some Python code similar to this: @echo off set /P State= ...
Jwem93's user avatar
  • 109
0 votes
1 answer
64 views

How to change file path in BAT file based on the current user?

I have a bat file to run some Python code similar to this: @echo off set /P State= Select State: set /P Year= Select Year: "C:\Users\MYNUMBER\...
Jwem93's user avatar
  • 109
1 vote
3 answers
139 views

Is there a difference between combining commands with & and running them one at a time?

Say I want to run multiple, computationally complex commands on Windows command line. Does it makes a difference, performance wise, if I combine them with &: doSomething1 & doSomething2 & ...
overdriven's user avatar
2 votes
1 answer
92 views

A batch file with an executable file checks if it is not in the processes in order to run another batch file (or code from it)

There are two batch files. Need to add a condition to the first file if the process is running nvcplui.exe then nothing, and if it is not running, then the second file (or the code from it) will be ...
Agodless's user avatar
0 votes
1 answer
38 views

How to extract a part of a line that is between two specific strings using a batch script [closed]

I am trying to extract strings which are between <meta property="al:ios:url" content="snssdk1180://live?room_id= and " data-rh="true">. Example Input: <meta ...
Enema State's user avatar
0 votes
1 answer
227 views

Back from Elevated Admin to Not Elevated

When running Batch Script with Administrator privileges, how to back to not Admin? I tried this example: @echo off :Demo CLS fltmc >nul && (echo Admin& set $A=y) || (echo Not Admin&...
Mr.Key7's user avatar
  • 823
1 vote
1 answer
67 views

Remove Empty Line at Top Command Prompt Start Up Display

This question is a continuation of post Modify Windows CommandLine Start Up Text After I succeeded in modifying the cmd startup display from its origin, so that it looked like this: CMD: Still there ...
Mr.Key7's user avatar
  • 823
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 >>...
Mr.Key7's user avatar
  • 823
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 ...
Mr.Key7's user avatar
  • 823
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 /...
Mr.Key7's user avatar
  • 823
0 votes
0 answers
32 views

scheduled batch file stops running and reports error

I have a batch file that contains the following line: @robocopy E:\ G:\ /DCOPY:DAT /xd $* syste* /xf ~* /s /xo /np /copyall /log:c:\back-EG.txt It is scheduled to run on the first day of month. I ...
joehua's user avatar
  • 287
0 votes
0 answers
16 views

Removing User Account through Registry using .BAT [duplicate]

I am not the best at scripting but do know enough to write and modify to do what I want. This is an Enterprise environment and after adding a computer to the domain, we would like to delete the user ...
Corey Jackson's user avatar
0 votes
1 answer
179 views

batch findstr not working with string saved in a variable

I'm trying to find a string inside a file.txt using findstr and I have the following issue: set "log_file=C:\Tools_Dev\log_file.txt" a-findstr C/:"text to find" %log_file% works ...
Fernando Lisa's user avatar
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 ...
Bel's user avatar
  • 43
0 votes
2 answers
334 views

Xcopy: Copy last modified file from folder

I need to copy the last modified file of a particular extension from a folder. For example a folder contains: File1.cas File1.txt File2.cas File2.txt File3.cas File3.pptx ... File100.cas File100.pptx ...
Hemil Mehul Shah's user avatar
0 votes
3 answers
270 views

Batch script to take first & second part of folder name and create new folders from them

Any wizards out there that can help with this? I have some music folders labelled like this "Taylor Swift - 1989" etc with just the music files and folder image in the one folder. I need ...
Shane Cusack's user avatar
1 vote
1 answer
2k views

Disable Microsoft Edge Restore Pages Functionality

I scheduled a batch script with Task Scheduler to routinely close and reopen Edge to my website once a day while the browser is opened in Kiosk mode. I have: Taskkill /F /IM msedge.exe :: wait three ...
sushi's user avatar
  • 115
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. ...
psycoperl's user avatar
0 votes
2 answers
227 views

Windows taskkill not finding titled cmd.exe

I'm starting a lot of .bats, in which I execute, for example: title Waterfall-Proxy I do this, to have an easier closing the right cmds when I want to shut them down. To shut them down, I'm using: ...
Deutsch - Musik's user avatar
0 votes
2 answers
8k views

Using a .bat file how do I copy a file from its current directory to another directory?

I want to be able to have the batch file in any directory and have it copy the file to the specified directory. I have tried using: set path="%~dp0" copy "%path%\test.txt" "C:\...
arjeplog's user avatar
3 votes
1 answer
1k views

Inexplicable “The system cannot find the drive specified.” How to solve it?

I'm creating a Batch file and it was working OK, then, suddenly, it started throwing an error that's making me scratch my head and reach the limit of my ignorance. I reduced the Batch file to the bare ...
Paulo Santos's user avatar
2 votes
1 answer
990 views

How to index into array with variable in batch?

I'm trying to process input arguments to a batch file, and I need to tie some paired arguments together before I call an executable at the end. I'm placing all the arguments into an array so I can ...
batchconfusesme's user avatar
3 votes
1 answer
3k views

How can I use Windows .bat files to create folder above current folder?

I need to make a .bat file for many people that would be placed in a specific folder and then move specific files from said folder to another folder above the current working directory. I don't have ...
kerstoff0mega's user avatar
1 vote
1 answer
5k views

Open network folder in a .bat file

How do I open a network folder with a .bat file? explorer shell:NetworkPlacesFolder works like wonders in CMD but once I try to implement a path (e.g. \\104pc01-01\c$\), it simply doesnt work and I ...
Ben Murray's user avatar
-2 votes
1 answer
563 views

Batch file to rename and move file to parent directory

I have a batch file that renames the first file in a folder to the name of the folder it's in and move that file to the folders parent directory. The problem I'm facing is that if there are multiple ...
Pacdizzle's user avatar
-1 votes
3 answers
172 views

How to modify this .bat file to include the name of the parent folder?

I've created this .bat file and added it to my context menu to help me quickly create a set of folders with predefined names when I'm starting a new project, this saves me time from creating all these ...
Kareem's user avatar
  • 93
0 votes
3 answers
2k views

parse a text file and delims : char in batch file

I am trying to parse a text file into a batch file. while delimiter with : character and extract value of PageLabelPrefix and place it into list.txt It seems that only the %%g has value, and %%h is ...
Alvin Fong's user avatar
0 votes
1 answer
242 views

Can I use a .bat file to rename all the FOLDERS in a directory?

Can anyone please help me figure out how to strip-off or remove part of all of the FOLDER names in a directory? I’m trying to remove this 7 character string “SSA RI ” (including the middle and ...
ron's user avatar
  • 3
0 votes
1 answer
779 views

VLC Command Line - Run stream and then quit

I'm making Windows batch files that I can run and listen to a stream in VLC but then press any key to exit and stop the stream. This seems to work but I can see the batch freezes after starting VLC. ...
Jake Sherlock's user avatar
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} \ {...
ElmerF's user avatar
  • 23
2 votes
3 answers
200 views

Seemingly impossible to extract URL string in between two text delimiters from 100's of messy Google News Alert emails with batch

For years Google News Alerts has sent daily emails when certain words pop up in websites, tweets, etc. and these emails (in HTML and .txt format) have one unique quality: there is no easy way to pull ...
user1798732's user avatar
-1 votes
1 answer
200 views

Cant choose "tag" after Tag_Folder.bat

I found this great answer that shows how to add tags to folders on Windows 10 but unfortunately it does not work as expected. If I right-click in a folder I can enter a tag but the problem is that I ...
LulY's user avatar
  • 99
0 votes
0 answers
102 views

Batch script error image upload

Wrote a batch script file that uploads an image to smugmug using the smugcli cmd tool in Python. Now I'm getting an error creating an album. I think it has something to do with the special character ...
BertW's user avatar
  • 1
1 vote
2 answers
657 views

How do I create a better drag and drop .BAT file that processes as many files as I select?

How do I create a better drag and drop .BAT file that processes as many files as I select? The purpose of this batch file is to convert any file with sound on it (mp3, ogg, mp4, etc) to a wav. I want ...
sp1792407's user avatar
0 votes
1 answer
1k views

how can we sort files according to their size using cmd batch files and print a wait timer till the loop is running?

How can we sorting the files with size in the decreasing order. What should i add ? for %%d in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do ( if exist %%d: ( echo Another process is ...
user avatar
1 vote
0 answers
287 views

Passing User Input to EXE using "Start" and set priority

I have a batch file input.bat I use to start an executable and pass in user input like so: foo.exe < userInput.txt I would like to run foo.exe in a high priority mode, which I can successfully do ...
user973995's user avatar
0 votes
1 answer
240 views

Can these bat/ps1 files be modified to open a folder on a MTP device (my current bat/ps1 scripts already work to copy mp4 files)

I am using the following .ps1 script and .bat file to copy MP4 files from a folder on my phone that's an MTP device with no drive letter (hence the need to use Powershell). I want to modify the ...
bat_cmd's user avatar
  • 551
0 votes
2 answers
1k views

Need a Windows batch file that will add string to each line of a dir command to produce a file list

I am working with the Informatica platform that only allows me to use batch files. I am currently producing a list of file names with the command dir /b /a-d 850_B_4545703_.txt 850_B_003029660_.txt ...
Kram_Koorbse's user avatar
3 votes
1 answer
528 views

Open email folder in Thunderbird (v102.7.1) using the windows command line

I'm trying to open a specific email folder in Thunderbird (v102.7.1), using the command line arguments. I already found out that using thunderbird.exe mid:<MESSAGE-ID> will open the email with &...
username's user avatar
3 votes
1 answer
3k views

How can I modify a Windows task schedule via command line without requiring a password?

I can create a task on the Windows 10 command line using SCHTASKS without needing to enter my password. For example: SCHTASKS /Create /TN my_test /SC MINUTE /MO 2 /TR "msg %username% Hello World&...
User's user avatar
  • 3,747
-2 votes
1 answer
983 views

Script to copy line that contains specific text and copy on another txt file [closed]

we nedd a script for Windows to copy entire line beginning specific word and paste on another txt file source file: < Date: Wed, 18 Jan 2023 00:12:13 GMT < Content-Length: 0 Compare hash: ...
juvenal's user avatar
  • 53
1 vote
1 answer
537 views

How can I add missing DOS commands to DOSBox?

I am trying to execute .bat file in the DOSBox: It starts with the following lines: echo off cls if exist %1:\BLA\z.exe goto custom if not exist d:\BLA\z.exe goto error APPEND d:\BLA;d:\BLA\...
matandked's user avatar
  • 165
0 votes
0 answers
57 views

On Windows 10 no automatisation possible , .bat .lnk cmd ignore Administrator

I wanted to implement a simple .bat with commands like rmdir & mklink on a virtual guest system , and there they won't run as intended. when running .bat as Admin , it wont execute rmdir (...
Mitten Wald's user avatar
0 votes
0 answers
3k views

How can I launch applications on Windows 11 from CMD that are located in the folder "\Program Files\WindowsApps\"?

On Windows 11, I want to be able to run a script that launches sets of applications when I want to launch them. For example I want different sets launched for "work" "personal" etc....
ktamlyn's user avatar
  • 121
0 votes
0 answers
116 views

PowerShell command makes windows loop

I've installed today, the Screenfetcher module for Windows - as follows: PS D:\INSTALKI\ScreenFetch> Find-Module -Repository Local Version Name Repository ...
Marcin's user avatar
  • 1
0 votes
1 answer
2k views

Access denied when adding key to HKEY_LOCAL_MACHINE using bat file, adding to HKEY_CURRENT_USER works fine

I need to add a new registry key to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsRunTime\AllowedCOMCLSIDs. I tried running a following bat script: @echo off REG ADD "HKEY_LOCAL_MACHINE\...
cooktheprogrammer's user avatar
2 votes
2 answers
1k views

Changing output file name in a batch file

Sorry, the title isn't very descriptive, but I couldn't think of a better one. I use this script to drag and drop video + audio file, and combine them with ffmpeg. ffmpeg -i "%~1" -i "%~...
DD3R's user avatar
  • 85
1 vote
1 answer
793 views

Redirecting the output to a file and command prompt simultaneously

Below code is in batch file as i'm running powershell script with batch file. but doesn't give any output. I am trying to use the tee code written for a bat file but am having trouble implementing it ...
Suraj Kumar's user avatar
2 votes
4 answers
2k views

replace variable output in one batch from another batch

The user manually types, in a window, the input data, which is stored in variables. Then the batch does an "echo" of the variables that contain the data that the user entered (first.bat): ...
acgbox's user avatar
  • 785
2 votes
1 answer
5k views

Trying to open a OneDrive directory file path using a batch file

I am attempting to open a OneDrive file path whose location is synced locally to my computer using a batch file, but after several trial and errors, I'm not able to determine what I'm doing wrong. So ...
Ryan's user avatar
  • 23

1
2 3 4 5
17