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.

Filter by
Sorted by
Tagged with
-1 votes
0 answers
18 views

batch file - set variable inside IF give me error [duplicate]

I have this very simple script : @echo off set OK=1 if %OK% == 1 ( set FFF=1 if %FFF% == 1 ( echo test ) ) I run it and got this error : ( was unexpected at this time. but if i then ...
andio's user avatar
  • 1,658
-2 votes
0 answers
49 views

MYSQL is not installing using batch script [closed]

I am tying to automate installation of MySQL using batch script. This is the script: @echo off REM Replace "path_to_mysql_installer.msi" with the actual path to your MySQL MSI installer ...
sid's user avatar
  • 7
-2 votes
0 answers
42 views

bat file conditional structure? [closed]

If the file dragged to the bat file is png, compress should be done, otherwise the converter should do it. How to make such a batch file? I don't know if the bat file is an if else It would be nice if ...
Burak Celik's user avatar
0 votes
1 answer
68 views

Command line for() with other conditions doesn't work

I am on Win10 x64 trying to automatize adding several www into Win10 HOSTS file so I do not have to make it manually myself. IF I do it for each www separately one-by-one, it does work, but if I try ...
fafa's user avatar
  • 89
-1 votes
0 answers
23 views

public key not found error in python webserver [closed]

#!/usr/bin/python # -*- coding: utf-8 -*- import subprocess,os '''when i try to run the gnupg encryption using python scripts , it is working fine, but the same doesn't work when i run the same ...
Sindhu DH's user avatar
0 votes
3 answers
82 views

Create INI files from Excel sheet values with Powershell or Batch file [closed]

I have a system that students have access to, but they use this system thought a RDP session and every access is recorded in our server to prevent misuse. I have created the whole structure for this ...
Sergio Baiao's user avatar
0 votes
1 answer
41 views

Batch: Issues with variables while using DisableDelayedExpansion

BACKGROUND: I have about 20 folders and from time-to-time individually select to run a .BAT file from within one of the folders, example complete folder path being the following: G:\419065 - patreon - ...
user13646154's user avatar
0 votes
1 answer
65 views

Cannot get the value and assign to a variable [closed]

I have try to use the following to get the MD5 for the txt. Output it to other file and rescan. dumb method but seem it return nothing every time. (certutil -hashfile %targetfolder%\%baseName%%n%\...
Samuel's user avatar
  • 220
0 votes
0 answers
28 views

Is there a way to start a process from CMD with focus on Windows?

I have a Python framework running automation on a Windows machine. Through this, I can execute commands. When I call a batch script (which starts an application), the application does not get focus. ...
scorpi03's user avatar
-1 votes
0 answers
31 views

Having trouble creating log files for an MSI installer in my batch script [duplicate]

I am learning batch scripting, and am trying to create an MSI installer that simply runs msiexec so I can install the same software to multiple computers easily. I got it to work, but wanted to add ...
GarnetPilfer's user avatar
-1 votes
0 answers
63 views

a BAT script for OptiPNG doesn't work as expected [closed]

This is a weird one, as the exact same script worked correctly for years, but for some reason, after I re-installed my windows 10 and upgraded to the latest 22H2 patch (previous Windows 10 ...
Pernicio's user avatar
0 votes
0 answers
29 views

How do I get the built-in function in TLC LE to work?

Hi i write basic script in .bat and one of the requirement is that script has to work in TLC LE 14.00.9 and use build in functions @ABS @INT @DECIMAL. I run it in TLC LE and i get always wrong results ...
Szymcio's user avatar
  • 11
-1 votes
0 answers
53 views

why doesnt my cmd code ask for username password ... is there something wrong? [closed]

The problem is that the code must ask for username,password for creating a user and username for deleting one but as you can see it doesnt .I tried putting the " pause " outside of the if ...
Konstantina Sourmelidi's user avatar
-1 votes
1 answer
51 views

Add text and rename multiple files

Okay, I have a lot of subfolders. Each subfolder contains some files. In each subfolder I want to add som text in the end of one file with the extension "tbn". The file name is not the same ...
David's user avatar
  • 1
-1 votes
0 answers
20 views

I made calendar by date command but date command says change new date [closed]

date command just says current and change new date So I just making os and here my code @echo off echo Booting System timeout 3 cls echo WELCOME %USERNAME% goto menu :menu echo Type the number. echo....
Fran Pogoric's user avatar
-1 votes
0 answers
27 views

Give standard user access to mount or create symlink

I'm using windows 11 and I create a standard user in my windows (username : AA ). I have a local z:\ drive and I want AA to be able to create symbolic link on it. AA has proper read access to the ...
andio's user avatar
  • 1,658
-1 votes
0 answers
19 views

Can't add spaces to webhook content in batch [duplicate]

I have been trying to make a discord client in batch, and for some reason the user cant add spaces or the program crashes. I have tried this but no luck cls echo Please type your message. (Type -1 to ...
Ender Carpenter's user avatar
1 vote
1 answer
122 views

bat file not running git push as generic user in task scheduler

I have set up a schedule in task scheduler to run a bat file containing git commands as a generic user. This bat file contains the following commands: cd C:\repo call D:\path\to\git --git-dir=C:\repo\....
bocodes's user avatar
  • 349
0 votes
1 answer
47 views

How to make `cmd` close when using `start` inside a .bat file

I am running Windows 11 and I have a .bat file with just this line of code: start powershell -file "Z:\xxxx.ps1" The problem I have is that when I execute this .bat file (double clicking in ...
batata00094's user avatar
1 vote
2 answers
69 views

"Press any key to exit" command prompt?

^!a:: hwnd := WinExist("A") for Window in ComObjCreate("Shell.Application").Windows if (window.hwnd==hwnd) { Selection := Window.Document....
medukia's user avatar
  • 39
-3 votes
0 answers
19 views

Where are the Hardware Address / Device Files listed in Windows 10? (McAfee Solidifier CLI commands/Win10 in use) [closed]

Our company uses McAfee Solidifier to lock down our Terminal PC's. I've been looking to find the minimum required folder(s) to re-solidify in order to allow newly attached peripherals to work and I'm ...
k1dfr0std's user avatar
  • 449
-1 votes
0 answers
37 views

Combining %date:/=% with %date:~4% using cmd [duplicate]

I'm trying to simply get 11302023 as the value. That is the current date today. If I type echo %date:~4% I get 11/30/2023 If I type echo %date:/=% I get Thu 11302023 I would like to basically combine ...
Fr0ntSight's user avatar
  • 2,712
-1 votes
0 answers
17 views

how to echo variable inside cmd batch for loop [duplicate]

I apparently cannot echo a variable when inside a FOR loop in my windows cmd batch file. If the batch file contains this set "TextFileCount=0" & for %%I in (*.txt) do set /A ...
LarsRD's user avatar
  • 1
0 votes
0 answers
43 views

Is it possible to add an option at beginning of a batch file to use commands in the batch file or ignor them?

I have wrote a batch file to run JDownloader (download manager) so my laptop will not go to sleep and then it would shutdown once the download is finished. All works as intended. @echo off for /f &...
rezpower's user avatar
-1 votes
0 answers
34 views

Errorlevel function in a For loop

I have the following code: echo.^> Checking Image ... for /f "tokens=1 delims=" %%i in ('dism /get-wiminfo /wimfile:"%drive%\iso\sources\install.wim" ^| findstr /l "Name&...
Olivier Regnier's user avatar
0 votes
1 answer
40 views

How to write a function in batch script that will parse text file to load variable values and return the result to the caller

Per this question: How to identify the list of unique variable names that are parsed from text file using batch script I managed to write batch script that will load the variable values and array ...
tarekahf's user avatar
  • 808
0 votes
0 answers
23 views

Is there a a way to disable certain monitors on windows via cmd [closed]

So i want to be able to easily (one click) disable and enable two of my monitors. As i mostly just need the main monitor, but turning them off via button isnt solving it, as windows still opens ...
r00tCode's user avatar
-1 votes
0 answers
44 views

If a user didn't type one of the possibilites, how do I make them go somewhere else? (Windows Batch)

I'm making a batch file where if the user doesn't type one of the possibilities, they go somewhere else. My current code has worked for a while, but once you go to another section and come back it ...
Luxorens's user avatar
-1 votes
0 answers
53 views

Windows CMD to list directory content and append to TXT file [closed]

I would like to use basic Windows CMD to list files from directory and append to a TXT file. If the file's last letter ends within {A-Z} then append to the file also. Without powershell, if possible. @...
WHISKAS's user avatar
-1 votes
0 answers
22 views

not able to run.bat or .exe file on wine(in ubuntu system) [closed]

I downloaded a voice conversion model in my ubuntu 20.04 system, in that I needed to run a .bat file, I tried to run it by using wine(version 8.0.2), but its giving an error, the .bat file contains ...
Ram 's user avatar
  • 1
0 votes
1 answer
55 views

How to identify the list of unique variable names that are parsed from text file using batch script

Thanks to @Magoo for helping me write the script to parse the text file. Reference here: https://stackoverflow.com/a/77561672/4180447 I have the following text file with array values and key values: ; ...
tarekahf's user avatar
  • 808
-1 votes
1 answer
67 views

Need windows script that moves files based on a string in the file

copy a few hundred plain text, ANSI files based on a keyword or content in a file on a windows server, so i would like to create a .bat file that i can run or schedule. The files in question all have ...
MKH's user avatar
  • 1
-1 votes
0 answers
31 views

Edit batch file to only append "_Reupload" to files in "Reuploads" folder rather than ".rtf_Reuploads"

How do I edit this batch file so that the files have the suffix "_Reupload" to all file names in "Reupload" folder instead of ".rtf_Reupload"? Currently when I execute ...
qplsn99's user avatar
  • 57
0 votes
1 answer
42 views

Colon in echo batch command

What does this command, found in a script, mean ? echo run cmake build: %Some_Directory%\CMake\build.bat cmake does have a build argument, but there should be hyphens : cmake --build Here is the echo ...
Oodini's user avatar
  • 833
-1 votes
0 answers
24 views

How to get file count value assigned to an environment variable with Windows batch? [duplicate]

I have made the following line in a batch file that counts the number of the specified file type in the current directory and would like to transfer that count into a variable (for later comparison). ...
LarsRD's user avatar
  • 1
0 votes
2 answers
43 views

How to parse text file to load arrays in batch script

If I have this text file keys.txt: key1=val 1 key2=val 2 key3=val 3 I can use this script to load this script to load the values: @echo off setlocal for /f "usebackq tokens=1* delims==" %%...
tarekahf's user avatar
  • 808
-1 votes
0 answers
26 views

How to Batch change folder permissions to read only? [closed]

I want to deny write access of a folder and all it's childs to everyone. Currently I'm using: icacls "D:\TEMP\Diagnostics" /inheritance:r /deny "*S-1-1-0:(OI)(CI)(W)" "*S-1-5-...
isidroco's user avatar
-1 votes
0 answers
41 views

Can't pass arguments to java application via shortcut

Windows 10 Content of file myApp.bat @echo off set CONFIG_FOLDER=%~dp0config java -Dexternal.app.config=%CONFIG_FOLDER%\application.properties -jar lib\my_app.jar From console I sucess run myApp.bat ...
Alexei's user avatar
  • 14.7k
1 vote
0 answers
53 views

The syntax of the command is incorrect in Batch Script [duplicate]

So I have written a batch script to do certain actions based on the parameter (argument) input. Here are the codes. @ echo off setlocal enabledelayedexpansion title Sysmon Installation Script SET ...
Philip's user avatar
  • 11
-1 votes
0 answers
29 views

How to delete files with a batch on another server?

I already tried deleting old files with this configuration and it works Forfiles /p "C:\Users\myname\Desktop\foldertest" /s /d -7 /c "cmd /c del /q @path" but when I change the ...
Emanuel Burgos's user avatar
-1 votes
1 answer
97 views

Windows Batch script to add entry to Registry

I'm attempting to create a batch script that would reproduce an entry in the registry I created manually. The script is going to be part of the installation process for a small WEB application I'm ...
FDavidov's user avatar
  • 3,553
3 votes
1 answer
122 views

How is multiplication in Libfixmath performed?

I am porting the library mentioned by Wikipedia https://en.wikipedia.org/wiki/Libfixmath in CMD Batch. The library uses an Q16.16 format. I am trying to port it in Q16.16 or Q15.15 format. What I can'...
Einstein1969's user avatar
-1 votes
0 answers
47 views

How to find large files in sub directories with Windows batch? [closed]

I try to detect large XML files (over 500 MB) in subdirectories of my batch file. Here is my script. It actually lists all files. There is used the comparison operator GTR. But it looks like there is ...
Gwenael's user avatar
  • 19
0 votes
1 answer
57 views

Batch: Action in a for loop depending on running processes

What's the best way to periodically check using a Windows batch script whether one or more processes are running, and then execute one block of code if any of those processes are running and a ...
velw's user avatar
  • 11
0 votes
2 answers
80 views

Download internet file using batch file with rename issue

I am trying to write a Batch file to download different jpg files from the internet. The path is in the format: "https:\abc.com\def\ghi.jpg\jklmno.pqrstuv.wxyz". I would like to use a batch ...
Alex's user avatar
  • 1
-2 votes
1 answer
60 views

How do I rename files with list of names using command prompt? [closed]

I have a .txt file with a list of names such as: george_washington thomas_jefferson meshach_browning I want to use the names list to rename the .xhtml files within a directory. For example: 00001....
WV-Mike's user avatar
-1 votes
1 answer
37 views

My Bat File for my python program is not running although I put in correct commands and paths

I wrote a simple python program and I'm trying to run it on a batch file, and I've checked all the possible errors I could have made on the batch file and it doesn't seem like I've done anything wrong,...
VSingh12's user avatar
-2 votes
0 answers
29 views

how can i put a content of a file to int, and then i can work with it like a normal number

I have this code: for /f "delims=" %%x in (ha.txt) do set mum=%%x This line is working in some way, but I can't work more with the variable mum. For example I can't do: set mum=mum+1 The ...
krkos's user avatar
  • 1
0 votes
1 answer
42 views

How to make Python script run as Administrator in Windows?

I trying to embed a Batch script use to activating Windows into a Python script, but the script need to run as Administrator in Windows so I find different solution, but none works. Here is the latest ...
TuanDung0902's user avatar
0 votes
2 answers
43 views

Reading specific line in batch file

I'm trying to get a specific value's variable from a setup.ini with a batch script. The variable's name is ProductId and I noticed that I have multiple variables with this name, but in different ...
aim0d's user avatar
  • 65

1
2 3 4 5
1079