Questions tagged [batch]

A batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter under MS-DOS and Microsoft Windows.

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

Extracting multiple password-protected archives located in multiple sub-directories

There is a folder that contains many folders and subfolders, and each of these contains any number of password-protected 7zip archives. The password is the same for all of them. These are single-layer ...
1
vote
1answer
17 views

How do I Pipe in Skip or Overwrite All when running the following bat?

How would I Pipe in Skip or Overwrite All (Always) to the following code? NB! the code recursively extracts archives with folders and sub-archives. FOR /D /r %%F in ("*") DO ( pushd %CD% ...
0
votes
0answers
25 views

batch windows running process dissapear when explorer restarted

i am running a program (command line tool) through bat file and minimize it to tray using menutools. sometimes later when a explorer.exe hang or restarted, the bat windows is nowhere to be found but ...
0
votes
0answers
38 views

enter username and password in a batch script

I run the below code that is log in to a server and after login, it's enter 1 and go to the next line but after that, I need to enter the username and password. help me to complete the code. @if (@...
0
votes
0answers
22 views

How can I create a shortcut using bat for a bat file and add an icon to it?

I just want to add the bat file to my desktop but using cmd code. set SHRT_LOCA=%userprofile%\Desktop\QT_cleaner.ink set SHRT_DEST=F:\qt\QT_cleaner echo IconFile=F:\qt\qt_logo_256px>> %SHRT_LOCA%...
1
vote
0answers
30 views

using start /wait for a headless process in a batch file - any way to show the process is running?

So I have a large batch file, and in the middle it hits a start /wait command to run a silent install of an MSI. I'd like to have some animation or something to indicate that the batch file is in fact ...
0
votes
0answers
61 views

Nginx Dynamic Port Forwarding By Root directory content

Problem I am trying to accomplish a dynamic port forwarding by dynamic subdomain. The port should be retrieved from any X source in current server. Also, I should be able to delete / create / update ...
0
votes
1answer
55 views

Allow domain user run batch files only from specific network folder

Googled about this but did not find the answer, Id like to give my domain users the ability to run batch files ONLY from network shared path which i'll create and put the files into. is it possible to ...
0
votes
1answer
233 views

Fast File Copy script in Windows

I have a process that is run every month or so. Such process identifies a set of files and constructs a proper source and destination path from several fields of different tables in DB to then copy ...
0
votes
2answers
87 views

sendMail.exe alternative [closed]

Have a bunch of in-house batch scripts and what-not that utilize sendEmail.exe, which is an old perl auto-emailer application which can be found here: github for sendEmail.exe The problem is that with ...
1
vote
0answers
23 views

Capturing output of remote process from sysinternal's psexec Script

I'm trying to deploy a program throught PSexec with a script from Bat file to use one CMD instance per computer and not one after the other. I need a log to be generated on my local server to be sure ...
0
votes
1answer
251 views

Windows Batch: Command FOR /F and Tokens, How can I ser variable from token X until end of the line?

Ok, I been struggling with this for days now. I have a little complex script but at the end I just need to set a variable from a Token 4 to the end of the line. Basically I run a command and the ...
0
votes
0answers
70 views

How to create a Shutdown Script for Server 2016

I have a Windows 2016 server running an Oracle database that needs to be manually shutdown before the server shuts down. I enabled the local GPO (Computer Configuration > Windows Settings > ...
2
votes
1answer
252 views

Getting full windows version on Batch or Powershell. (Like “Microsoft Windows [Version 10.0.18363.900]” On Windows Server 2016

I have this issue. Using just command "ver" in batch I get: Microsoft Windows [Version 10.0.18363.900] I need the last sub-build version (900) for an script to determine if windows is on ...
0
votes
1answer
531 views

How to secure the SQL credentials in a batch file (PowerShell inside) to run a script using sqlcmd

My goal is to create a batch file which performs a SQL (express) DB backup every time it's executed. But I don't want to store a clear password in that batch. Using PowerShell, I successfully created ...
0
votes
0answers
326 views

multiple robocopy calls in one .bat file won't run

I'm trying to backup some files from my Windows server to an external USB drive using robocopy. Running robocopy tasks in cmd works fine but in the .bat it won't run and instead just echoes the ...
0
votes
1answer
914 views

Read Local “HKEY_CURRENT_USER” from another user, windows batch/powershell

Ok is a tricky question, I know. I have a software that runs validation scripts in all computers in network. I can create my own scripts too. But I found a problem that the script runs as specific ...
3
votes
1answer
10k views

Microsoft Intune - How to modify Windows 10 registry settings?

Win32 app uses bat file to install software and edit registry keys. Registry keys are modified if I run bat file locally but not when run through via Intune because Intune runs installation as System. ...
3
votes
3answers
213 views

How to get all processes under a session of a particular process that is using a port in Windows cmd

I want to list and kill all processes belonging to a session of a particular process that is using a port. This should happen through a windows batch command that would accept a port number as input. ...
2
votes
2answers
2k views

Windows Batch - Get name of currently logged-in user

In a sort of small mitigation for a large network for the exploit of replacing utilman.exe on windows repair, by cmd.exe, then changing user password, I'm doing a small script based on EventSentry ...
0
votes
1answer
136 views

RDP into a machine with out a user password

The computers dont have passwords, even the admin account ass they are training units. But we cant RDP into them with out passwords. I know the settings are at Windows Settings\Security Settings\...
0
votes
1answer
702 views

Get the previous day date as variable in batch file from powershell command output

The scenario is like this. I need a previous day date (i.e. Today -1) as variable in a batch file. But if previous day is Sunday (i.e. script running on Monday) it should return the Saturday's date (i....
1
vote
2answers
337 views

Can't remote reboot domain PC

I use bat + Powershell script to reboot a domain computer. I do not want to use domain admin but local user with admin privileges. bat file: PowerShell -NoProfile -ExecutionPolicy Unrestricted -...
1
vote
1answer
60 views

language-neutral recursive takeown

In .bat files for Windows's cmd.exe, recursively taking ownership of a folder's content goes takeown /f foldername /r /d Y >nul: 2>&1 Problem is, it works only if in the current locale the ...
0
votes
0answers
35 views

BAT script to return server licenses at shutdown?

My office uses program licenses that have to be manually activated and returned, and people tend to forget to do this when they go home for the day, resulting in most licenses tending to be ...
0
votes
0answers
43 views

Required Microsoft RSAT dlls and exe files

I've got to script some Active Directory actions (remove computer object) but will be limited to using a batch file; I'm tied to a product that is looking for a specific batch file. I'll place my ...
0
votes
1answer
313 views

Using PsInfo with a Timeout Procedure (or piping through PsExec?)

We have a problem with people in our company leaving their computer running 24/7 even over weekends. Our corporate policy is to shut down when not in use but that doesn't always happen. So what we ...
2
votes
2answers
2k views

Change Registry Key Permissions Access Control List using only Command Prompt

I am trying to change the Access Control permissions on a specific registry key i'm generating using a batch file. I try using regini.exe to pull the configuration from a .ini file and run into ...
0
votes
1answer
473 views

Create Widows Service from batch or exe file

I need to distribute some app to all our stations without users having the ability to close the app. The app jumps on users' screen and notifies them to restart the computer, and I don't want users ...
1
vote
1answer
3k views

Grant “Network Service” Read Only Permissions to Cert for RDP via Batch

I'm securing RDP by adding my SSL cert to my Windows host and of course, I'm working on scripting everything. I've got it 99% complete, the only step I can't figure out how to script is relating to ...
2
votes
1answer
104 views

Batch script with %date% variable

I do robocopy using .bat script, this script is starting 22PM before midnight and it took over 5 hours to complete. The problem is that destination folder is created with date \nas01\%date% so when it ...
3
votes
3answers
18k views

Start GPO script as administrator

I need to install a software using a login script, which is distributed by the GPO. Currently it is starting, but it is not run as an administrator, so the installation is not done. How can I make ...
2
votes
2answers
149 views

Azure Batch, Low priority nodes not working at all

We have been using low priority nodes in my company for a really long time. Every now and then we get preempted nodes but our tasks end up running eventually. We have 1 dedicated node, and we scale ...
8
votes
1answer
2k views

Shutdown script doesn't run if workstation is not connected to the network

I have a requirement to run a batch script every time a system is shut down, no matter if the computer is connected to the network or not. (It shouldn't matter for the question, but the script in ...
0
votes
1answer
111 views

can you sum within a function or use '!' within '!' in cmd?

Having some difficulty with the delayedexpansion in cmd. This might be a stupid question but is there any way of summing within a function (ie without 'set') or using ! within ! (or something to ...
1
vote
1answer
772 views

Windows batch file scripting: how to get directory named with latest date (yyyy-mm-dd format)?

I have a directory with many subdirectories. Each subdirectory is named with the yyyy-mm-dd format. I'm writing a Windows batch file and I need to grab the directory name with the most recent date and ...
-1
votes
1answer
2k views

For Loop in cmd and powershell - 1 is unexpected at this time

I need to run a for loop, from powershell, in cmd... aka, at the PS Prompt: cmd /c For /L %i in (1,1,5) DO (Echo %i) But, I get a "1 is unexpected at this time" Other responses in my research ...
0
votes
1answer
120 views

Batch Script for service restart and alerting over email

Please let me know what i am doing wrong in my code. I am trying to check a set of Services starting with specific set of name. And triggering an email if service is in stop state. I have made a loop ...
0
votes
2answers
2k views

How to run in background a Linux command in Windows WSL (Ubuntu1804)

In the effort to bring some of the Linux advantages to my customers running Windows 10, I've developed a few bash scripts in order to automate some of their everyday tasks. I use to let them run the ...
3
votes
1answer
632 views

Windows Command - Delayed Expansion Syntax to Echo The VALUE of a Variable That Contains Another Number Variable

I am trying to echo the VALUE of a variable whose name contains another variable ($project!$project_number!_control) while using delayed expansion. I can't figure out the syntax to do this. Here's ...
0
votes
0answers
930 views

Update Group Policy via Batch Script or Powershell Windows 7

I administer about 300 remote computers (all across the country) that are on Windows 7 Pro (32-bit) and I need to change the Group Policy. This is the first time in 5 years I've had to change the GP. ...
0
votes
1answer
421 views

Create .txt file with all PC names on domain for WMIC?

I'm wanting to run WMIC to call an uninstall for a certain bit of software, and, I have a working WMIC command, but I don't know how to create a .txt file with all of our computer names. Does anyone ...
2
votes
1answer
34 views

Launch a batch script with path modification in EC2

I am quite new to AWS but I think I understood how to deploy an EC2 instance, what I am trying to do is install apache tomcat and all that is needed for this on a windows server 2016 using the user ...
0
votes
1answer
1k views

Pass PIDs from tasklist and kill processes with tasklist WITH spaces in the name of the process

So this question is VERY similar to this question, with this answer. But some of my processes have a space in the name, and CMD returns nothing. My original question has been answered in this answer, ...
0
votes
1answer
247 views

execute check and repair mysql(wampserver) from a batch file

I'm trying to run check mysql and repair mysql functions in a sql file from another batch file. I get the error as: C:\wamp64\bin\mysql\mysql5.7.19\bin\mysql.exe" "mysql -u root -p < batch.sql" ...
3
votes
1answer
11k views

Get PowerShell command output as a variable in bat (cmd) script

I'm trying to get FQDN of a host in some .cmd file. We have disjointed AD domain so "@echo %COMPUTERNAME%.%USERDNSDOMAIN%" does not work. I mean it works, but returns wrong value. The solution I ...
-1
votes
1answer
2k views

Batch File if process is running kill task

I need to run this batch file remotely through PDQ deploy here is the batch file: @echo off taskkill /f /im wccad.exe >nul taskkill /f /im ACSR.exe >nul cd C:\csg\wccad\ wccad.exe -run ACSR ...
2
votes
0answers
259 views

Automated Install of PADS (Mentor Graphics) works manually but not in Software Center

I am trying to automate the install of PADS VX.2 or PADS VX.2.2 (made by Mentor Graphics) to be ran with Software Center. It has a proprietary batch tool that I used to make a silent install script, ...
16
votes
2answers
67k views

call batch file and run using its own path/directory

I have a batch files that calls other batch files like this: e:\foo\master.bat has the content: call e:\bar\run1.bat and e:\bar\run1.bat has the content app1.exe the problem is that when I run ...
1
vote
1answer
612 views

how to use logical operators and tasklist

I m using logical operators and tasklist command in a single sentence but it is not working. My batch script: tasklist \fi"memusage gt 18000" && \fi"memusage lt 19000" Can anyone help me out?...

1
2 3 4 5
7