Questions tagged [batch-file]

A batch file is a text file containing a series of commands that are executed by the command interpreter on MS-DOS, IBM OS/2, or Microsoft Windows systems.

-1
votes
0answers
4 views

Batch script to read keys and update value

{ "productVersion": "1.7.0", "examplePath": "somepath", "exampleBootloaderScript": "addin.js", "cachePath": "%APPDATA%\\example\\example", "logPath": "%APPDATA%\\example\\example\\...
0
votes
2answers
29 views

Pass a path with space as an argument

I'm running some code in C# where I call a batch file, and I need to pass a Path with space as an argument and it does not work. I have tried to call my argument different ways in the batch %1 , %~1, ...
0
votes
0answers
8 views

How do i open a new command prompt from a batch file in a different color

I can't seem to open a new command prompt from a batch file in a different color I have tried adding in the color command in different positions but it never opens the new command prompt in the color ...
0
votes
0answers
6 views

Is it possible to call another bat file without poping out a new command window in a batch file?

I was trying to do some pressure test in which there are a few batch files with calling relationship between each other. A batch file would use 'Call' to start another batch file. Considering that ...
-2
votes
0answers
15 views

Copying folders with partial name and date

I have a bunch of folders with names like this: name name_22.04.2014 name_21.04.2014 name_12.11.2015 name_02.11.2015 name_05.06.2013 I need to copy contents of the latest dated folder into the name ...
2
votes
1answer
31 views

XML - Modify element content(s) recursively based on matching criteria(s)?

I have an XML File, in which I would like to amend particular strings of text within elements based on different matching conditions which are detailed below. It may take a while to read and ...
1
vote
0answers
27 views

XML - Delete nested element based on matching condition then rename remaining elements?

I have an XML File, I would like to delete a particular element based on a matching condition, then rename/renumber the elements that remain. <AudioTracks> overall can contain a number of ...
0
votes
0answers
27 views

Can someone explain the new line hack in batch in detail?

@echo off set NLC=^ set NL=^^^%NLC%%NLC%^%NLC%%NLC% Usage: echo There should be a newline%NL%inserted here. I've looked at this article here on Stackoverflow, but it doesn't quite explain the ...
1
vote
0answers
32 views

how do I get python to run a exe and reference a file

Quick note: This is on a windows environment. I am working on a script to run femzip on all files and folders in a shared drive. I have a batch file that does something similar. Issue is, it is ...
0
votes
1answer
26 views

How can I pull a substring from a filename with a batch script?

I have hundreds of files I want to rename to match a new convention. Current convention is AA.BBBB.XXX I want to change it to BBBB.AA.XXX I've cd'd into the folder which holds all of these files. I ...
0
votes
1answer
27 views

Using two or more set /p in the same line

Im trying to make a script that the user need to fill 3 spaces in the same line. Is it possibile? For example filling a date: 25/02/2019 in this way: day here / month here / year here Not line by ...
0
votes
1answer
20 views

1st Batch File attempt - trouble with asynchronous commands

I am trying to write my first ever batch file that builds a React application (using node package manager) nested inside a SilverStripe project, and renames the js and css build files, and moves the ...
0
votes
0answers
18 views

how to echo environment variables inside an IF clause when SETLOCAL is enabled

how to "echo" the value of (environment) variables that should expand environment variables themselves? example BAT: echo OFF SETLOCAL echo running test ... set /a "YesPleaseContinue=0" IF ...
0
votes
1answer
19 views

Move Files with Same Beginning String to a Folder with That String Name

So I have a set of files that look something like this: [text A] (space) "(" [text 2].extension example : Joe (Nice Guy) (1993) (v.1).abc Joe (Bad Man) (2001) (File B).xyz I would like to do the ...
0
votes
0answers
21 views

Get TeamViewer's ID's remotely

I'm trying to create a batch file to get the TeamViewer ID's remotely. The problem is that I'm not sure how to query the registry with another account. I have some code to show, but it doesn't really ...
0
votes
1answer
18 views

cmd script reading from file and writing to file loses empty line

I have a cmd batch script which: reads from a file line by line if the line matches the specified string, it outputs that line plus 2 new lines into the new tmp file if the line does not match the ...
-1
votes
1answer
24 views

How to modify text inside of a csv file from command prompt

I have a set of data from my Student Information System and I want to change the username in the csv from test.student to an email address test_student@testdomain.com that is in column D of the .csv ...
-1
votes
0answers
22 views

I am running a batch file that [duplicate]

I am running a batch file that creates a CSV file fetch the data from Database, but the resulting CSV file starts with a blank line which causes me some problems. Any way I can modify my bat file to ...
-2
votes
0answers
18 views

Batch file to move second line of csv format UTF-8 in another csv format UTF-8 with different name and path [on hold]

I need a batch file to move the second line of a csv format UTF-8. The first line have the header and this can not be moved. The paths of csv have space and are in different folder. Csv format is ...
0
votes
1answer
26 views

Calling rsync in bash from Windows cmd

I am trying to run rsync from a batch file. The command is SET CMD="rsync -P -rptz --delete -e 'ssh -i /root/.ssh/CERTIFICATE.pem' SOURCE_ADDRESS /mnt/c/Users/MYNAME/IdeaProjects/PROJECT/SUBFOLDER/...
0
votes
2answers
57 views

Errorlevel not working when using date command in batch file

I've made this code to change the date. But when i enter a wrong date, the errorlevel command appears beeing ignored. @echo off @setlocal enableextensions @cd /d "%~dp0" mode 48,12 :start cls echo. ...
0
votes
1answer
24 views

Windows batch if not equal do not execute if clause

I have a .bat file to execute in a windows server 2012 R2 machine. Problem is that I need to add an "if not equals" but when I try to execute it the code does not work. I know that problem is in the ...
0
votes
0answers
11 views

include external jars(multiple jars) when running java program from batch file [duplicate]

Executing a java program from batch file that is having dependent externals multiples jars. So, How to include those jar file. Note :- while running java program fromeclipse. i am using -DINSTALL_DIR.
0
votes
1answer
18 views

UNC Paths are not supported

I am trying to copy a file to a folder using the following batch script echo xcopy \\path1\file.txt \\path2\backup However, I get the following error: UNC paths are not supported. Defaulting to ...
0
votes
3answers
41 views

How can I loop through specific file names with the Compress-Archive command in Windows PowerShell?

I am not too familiar with Windows PowerShell (and Windows console commands in general), but I wish to write a batch file which can create sperated .zip archives from specific files in a folder, then ...
-2
votes
0answers
26 views

I am running a batch file that creates a csv file fetch the data from Database

@echo Off set qty=-1 :loop4weekends set "separator1=-" set "separator2=_" echo >"%temp%\%~n0.vbs" s=DateAdd("d",%qty%,now) echo>>"%temp%\%~n0.vbs" d=weekday(s) echo>>"%temp%\%~n0.vbs" ...
0
votes
0answers
29 views

How can I access exported .reg file using batch?

I exported registry keys to a .txt file using reg export command. I cannot read this file using for /f. I tried to change code page using chcp command although I didn't get any better. When I change ...
0
votes
0answers
20 views

Use Double Delayed Expansion to SET a variable in a batch file

So I'm trying to use double delayed expansion to rename files in a directory. The issue I'm having is using double delayed expansion with the SET command. This method works as expected with the ECHO ...
0
votes
0answers
21 views

How to fix 'empty file after run mysqldump with task scheduler'

I am trying auto backup for mysql, and i write .bat file, it working (Only there is a warning in cmd "Using a password on the command line interface can be insecure"). After, i try set up win task ...
-1
votes
0answers
18 views

Problem using MSBuild Tool name in multi-line batch file in Pipeline script [on hold]

In Jenkins->Global Tool Configuration->MSBUILD I Added a MSBUILD like below Name: MSBuildTool2017 Path to MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\...
0
votes
1answer
21 views

How to delete newly generated files in a batch file

I need to delete the files whichever is newly created in that path. In our case, we will have multiple files in a certain path. After running our application, it will create new files. I need to ...
0
votes
0answers
19 views

Running Windows 10 “Store App” from the command lines throws a “Access is denied” error [on hold]

I'm trying to start the Pandora windows application from the command line through a bat file using this command: start "Pandora" "pandora:" Every time i try it, regardless if i run cmd as ...
1
vote
2answers
57 views

Modify repeating word/text in XML based on matching text/parameters?

I have an XML file, containing the following: <SubtitleTracks> <SubtitleTrack> <IsNotifying>true</IsNotifying> <Burned>false</Burned> <...
0
votes
1answer
38 views

Delaying a schedule task

I have a schedule task i.e mytask on 50of my computers(windows) and i am working on writing a batch file to delay the task by 2 min on all 50 computers, is this the right way to go about it ? I come ...
1
vote
1answer
33 views

pushd not working in a batch file with delayed expansion

I have read many questions and answers about pushd here and on other sites, the overwhelming majority of them referring to issues with UNC paths. However, I've got a different problem I haven't seen a ...
1
vote
0answers
20 views

echo batch file array element in for-loop using the iteration variable for the index? [duplicate]

This question is similar to that of Echo batch file arrays using a variable for the index? but it doesn't answer my question. I have a batch file that contains a list. I am iterating through a for ...
0
votes
0answers
29 views

Is there a way to set the library path through batch?

I tried to make a batch starting my .jar so it look´s better. But my .jar needs some native librarys and I don´t know how to set them threw my start batch. I already tried to use the -Djava.library....
1
vote
2answers
48 views

Convert .bat to Powershell

Looking for a bit of help here. I have the following batch file that I am looking to convert to powershell. What it does is edit a registry entry remotely. The lines are the following: sc \\...
0
votes
0answers
17 views

code meant to unlock folder is not working

I am trying to access a password protected folder i created months ago but it isn't working. I copied the code from the internet and made appropriate changes to it like password etc but now it just ...
0
votes
0answers
19 views

How to run batch command with spaces from python? [duplicate]

I am trying to run compile_command = r'"C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin\MSBuild.exe" "input/Applications/EPMD-Software/IpProtector/IpProtector.sln" /t:...
-2
votes
1answer
17 views

How to create filelist from folder but with randomised order? In batch

How to create filelist from folder but with randomised order? In batch. Is it possible in batch?
0
votes
0answers
27 views

BAT with VBS doen't run from WTS

I need to run a .bat file from Windows Task Scheduler WTS. If I run the .bat with double click it works. But it isn't working when launching from WTS. On WTS my action is: C:\path\file.bat The file....
0
votes
1answer
20 views

Batch / How to open a .txt file with default editor?

Let's say I had a batch file: echo Would you like to open text.txt? (y/n) set/p "cho=>" if %cho%==Y goto OPENFILE if %cho%==y goto OPENFILE if %cho%==n goto END if %cho%==N goto END echo Invalid ...
1
vote
0answers
27 views

Why does this batch file fail for some users?

I have a batch file that copies the most recent version of an access front-end file to the user's C: drive and then opens it from there. For some users, the copy command causes the batch file to ...
0
votes
0answers
37 views

Is there a CMD command to refresh the “Date modified” in Windows?

I'm workin on a batch script that automatically copies all log files with a max age (n) to a new location. While testing the script i noticed, that there some log files were missing and the reason ...
1
vote
2answers
57 views

How to safely echo FOR variable %%~p followed by a string literal

I have a variable %%p created from for /f command When i try to use it with some additional references like: %%~dp and then write some text afterwards it accesses a different variable set var="%%~...
0
votes
1answer
32 views

Update a variable value on .bat file from powershell output (invoked on same .bat)

Have the following code and wanted the result from powershell to be in aux_var. (regular .bat file invoked from cmd) @echo off set aux=123.657.999 echo before%aux% powershell -Command "'%aux%' -...
0
votes
2answers
26 views

ffmpeg output Filename from multiple source

I want to have the output file to have same name from source ( for eg first filename from list.txt), how can I do it? This is the code I have which converts the all the .avi in folder to a single ...
0
votes
2answers
47 views

How to delete only text files except few files

In a certain path I have some different kinds of file type. Eg., .txt, .bas, .cls, etc. I need to delete only the text files in that path except few files. For eg, if the path has a.txt, b.txt, c.txt, ...
-2
votes
0answers
21 views

Batch decrypting of pgp files

I am unable to do the batch decrypt of multiple files in a folder and post the output to another folder. Anyone has a working solution for the same? How should I correct my code? for /r D:\Source %%i ...

http://mssss.yulina-kosm.ru