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
0 answers
12 views

BitLocker add Numerical password [duplicate]

I want have on PC add Numerical Password. What should I do. Because how much I searching for information can't find any specific. Any advice? Because in other device Volume C: [Windows ] [OS Volume] ...
Darbas Darbas's user avatar
0 votes
1 answer
109 views

Why I can do a wildcard copy from one location, but can't from another?

One wildcard batch copy works for me: sudo cp /home/jenkins/dist/*.war /opt/tomcat/webapps/ but another similar doesn't: sudo cp /opt/tomcat/webapps/*.war /home/jenkins/archive cp: cannot stat '/opt/...
Ilya Yevlampiev's user avatar
0 votes
1 answer
127 views

How to create and manage a new DCOM object via batch or powershell

Win+R. dcomcnfg > I need to register a new dll using this tool as a COM. I can do this manually. But I have a lot of WS. regsvr32 is not enough. The COM App need to exist in dcomcnfg So, can it be ...
Inkvee's user avatar
  • 3
0 votes
0 answers
21 views

AWStats a network drive

I am running AWStats from a NAS networked drive on a Windows network. The apache sever log files are also on the NAS network drive and the path includes the network drive letter along with locations ...
Leora's user avatar
  • 1
0 votes
1 answer
297 views

Delete selected subkeys in a registry key

I need to Delete selected subkeys in a registry key. For one of the subkeys I need to delete I tried: (SET _KEY=SOFTWARE\Microsoft\Windows\CurrentVersion\UFH\SHC) REG Delete "HKCU\%_KEY%" /V ...
Docfxit's user avatar
  • 11
1 vote
0 answers
224 views

Syntax for creating SCHTASK.EXE tasks to run batch files that take parameters

I have a set of older batch files that scheduled the running of some maintenance tasks for a database that I look after. They used the AT command. The database has been moved to Windows server 2016 ...
Jonathan Elkins's user avatar
0 votes
1 answer
469 views

How can I redirect the output of one command in a batch file?

Edit: This question has been answered, please scroll down ⬇️ This question is related to Server Fault because I am automating minifying some web files before deploying them to my server. So I have a ...
HackerDaGreat57's user avatar
0 votes
1 answer
4k views

Using GPO to run batch files at logon not working

I'm having a weird issue with creating Group Policy on an inherited Domain Controller. This thing was never set up properly, and I'm not well versed in working with Group Policy. We are running ...
GW_IT's user avatar
  • 11
1 vote
0 answers
155 views

Is it possible to open a file within a batch file as another user?

im trying to run psql.exe (postgreSQL) with an active code page set to 1252. I want to have a batch file that opens up a command prompt with that code page, then navigates to the psql directory to run ...
Vanillaice's user avatar
0 votes
1 answer
206 views

What is the best AWS infrastructure to run a migration of data from one SQL server to mongoDB?

I have some terabytes of data in our legacy system which runs SQL server. Our newer version runs on MongoDB. We are migrating this data to MongoDB. We have python scripts written and verfied, all data ...
J Bourne's user avatar
  • 101
1 vote
1 answer
116 views

weird behaviour in a Windows 2019 .BAT script

I have to restore a backup from a Linux MariaDB to a Windows MariaDB, where the PowerBI gateway will import its data. "mariabackup" is MariaDB's physical backup tool. But to restore it, the ...
Gilberto Martins's user avatar
0 votes
1 answer
517 views

How to reset the "allow pc to be discoverable on this network" prompt?

I have been advised to ask this question here on ServerFault. I've searched StackExchange, StackOverflow, and Google and I'm not finding any insights on how to reset the prompt when first connecting a ...
k1dfr0std's user avatar
  • 101
0 votes
0 answers
36 views

at-command: Scheduling and process priority

I have about 10 "at" jobs. There are cases where there is a conflict of resources and I am trying to find a neat way to schedule this. Say, job#5 may want to start before the job#4 ends. ...
SEU's user avatar
  • 101
0 votes
1 answer
370 views

Looking for a way to replace every instance of a non-zero sized file in a directory tree using a batch file

I am trying to figure out a way to have a batch script overwrite every instance of a non-zero byte file inside of a specific directory and its sub-folders. I'm guessing since I'm looking for a non-...
wb6vpm's user avatar
  • 23
0 votes
1 answer
6k views

Batch - Extract string before the specified character

How to get the string before the character hyphen? The following code gets the string after the hyphen. How can I reverse this? set string=1.0.10-SNAPSHOT echo %string:*-=% SNAPSHOT But I want the ...
user630702's user avatar
0 votes
0 answers
157 views

How to write a batch job query that has wait times, dependencies and conditional execution?

I'm trying to write a batch job that executes via task scheduler. The objective is to run these exe jobs sequentially. However, some of these jobs have dependencies on others. for eg. job1.exe (no ...
i_wonder's user avatar
0 votes
0 answers
25 views

batch folder rename on macos / linux

I have 500+ folders which are named with this pattern: May 2020 The folders contain photos, but for some reason the photos creation date in the meta is wrong, or was overwritten. The correct ...
zippy-flop's user avatar
0 votes
0 answers
699 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 ...
Bamba's user avatar
  • 1
0 votes
1 answer
107 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% ...
JTech's user avatar
  • 1
0 votes
1 answer
10k 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 (@...
Abhinav Thakur's user avatar
1 vote
0 answers
500 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 ...
Luke's user avatar
  • 577
0 votes
1 answer
2k 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 ...
Shahar Weiss's user avatar
0 votes
1 answer
518 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 ...
Carlos S. Na's user avatar
0 votes
2 answers
727 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 ...
d34db33f's user avatar
1 vote
0 answers
660 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 ...
Mainacety's user avatar
0 votes
1 answer
2k 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 ...
DefToneR's user avatar
  • 527
0 votes
0 answers
760 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 > ...
mpalmer22's user avatar
2 votes
1 answer
2k 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 ...
DefToneR's user avatar
  • 527
2 votes
1 answer
3k 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 ...
Laurent Moya_etc's user avatar
0 votes
1 answer
4k 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 ...
DefToneR's user avatar
  • 527
3 votes
1 answer
32k 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. ...
JPX's user avatar
  • 151
3 votes
3 answers
3k 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. ...
Abhijith Gururaj's user avatar
3 votes
6 answers
10k 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 ...
DefToneR's user avatar
  • 527
0 votes
1 answer
1k 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\...
Orion Pax's user avatar
0 votes
1 answer
3k 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....
Niraj Jaradi's user avatar
1 vote
3 answers
632 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 -...
zuku's user avatar
  • 61
1 vote
1 answer
163 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 ...
fgrieu's user avatar
  • 432
0 votes
0 answers
86 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 ...
Oskar Calais's user avatar
0 votes
0 answers
98 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 ...
Yaemish's user avatar
0 votes
1 answer
787 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 ...
ADY's user avatar
  • 93
2 votes
2 answers
6k 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 ...
Joe Bales's user avatar
0 votes
1 answer
3k 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 ...
Haim Ben's user avatar
2 votes
1 answer
8k 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 ...
FreeSoftwareServers's user avatar
2 votes
1 answer
2k 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 ...
zuku's user avatar
  • 61
4 votes
4 answers
61k 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 ...
Ivo Jesus's user avatar
2 votes
2 answers
237 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 ...
Renato Fontes's user avatar
9 votes
1 answer
3k 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 ...
Per von Zweigbergk's user avatar
0 votes
1 answer
230 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 ...
user519110's user avatar
1 vote
1 answer
3k 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 ...
slantalpha's user avatar
-1 votes
1 answer
4k 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 ...
Jeff's user avatar
  • 1

1
2 3 4 5
7