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
23 views

Set proxy.pac by script

In my company we are using a proxy that is set via a proxy.pac. Additionally to make life easier I am using a socks proxy via ssh to reach a special network area that is usually only available via a ...
0
votes
0answers
38 views

Windows Search Indexing Locations: GPOs don't apply when setting via registry

If I enable of the following templates via gpedit.msc, they apply correctly: Computer Configuration\Administrative Templates\Windows Components\Search Default excluded paths Default indexed paths ...
0
votes
1answer
27 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
186 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
40 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
24 views

Is there a local DNS server that can be configured from cmd?

I am using Technitium as local dns server on my windows laptop. It routes all traffic (*.com, *.net, *.org etc) to a local nginx server. I need to achieve the same functionality from a batch script. ...
0
votes
0answers
30 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
27 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
91 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 ...
0
votes
0answers
55 views

Robocopy move files from a directory but keep some files

I am trying to move files from one folder to another when it reaches a limit, and keep some files in the source using batch scripting. I tried with move but the source folder is read by another ...
2
votes
2answers
679 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
139 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 ...
0
votes
1answer
631 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
67 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 ...
2
votes
3answers
3k 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
89 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
887 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
96 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
403 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
1k 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
94 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
890 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 ...
2
votes
1answer
458 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
563 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
139 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
32 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
704 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
165 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
7k 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
1k 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
188 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, ...
12
votes
2answers
46k 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
227 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
votes
1answer
207 views

How to get a specific program from the task manager

i want to get the process that is running with the GDI Object 157 using batch script command but not able to do so my script is tasklist /fi "gdiobject eq 157"
-2
votes
2answers
485 views

Check existence of multiple network shared files

Let's say I have a list of files (files.txt), which looks like: \\myshare\file1 \\myshare\file2 \\myshare\file3 How is it possible to check via a batch script (windows) to check if those files exist ...
1
vote
1answer
6k views

Deleting $RECYCLE.BIN from userprofile via logoff script

I've got a RDS solution which utilizes User Profile Disks. There is a bug with UPD's which means that every now and then permissions on the users individual Recycle Bin's get mixed up and the user is ...
1
vote
0answers
53 views

Q: How Robycopy deals with pointers to directories (short-cuts)

For example, in the statement below robocopy %src% %target% copy:DATSO the parameter %src% may be a pointer to a directory. In my case, Robocopy FAILED TO COPY the content the pointer is pointing ...
4
votes
1answer
92 views

Batch Process Performance on Linux

My end users wants to run batch processes concurrently on a Linux box. Their impression is that running multiple of them at same time will reduce turnaround time. These processes do fair amount of ...
1
vote
1answer
2k views

Send a SecureString Password from CMD file to Powershell [duplicate]

I have a CMD file from which I have to run a Powershell script passing in username and password: i.e: PowerShell -File "%1" -Computer "%2" -Username "%3" -Password "%4". Is there anyway to send a ...
0
votes
1answer
871 views

How to hide the java keystore password in keytool scripts

As part of our project, we are pushing in the SSL certificates onto the rich clients which try to establish the connection with SSL based web servers through a windows batch script. This script ...
1
vote
1answer
591 views

Why my choice batch command always selects first integer choice?

I created a simple menu of choices of numbers like the following: @echo off CLS :MENU ECHO. ECHO ............................................... ECHO PRESS 1, 2 OR 3 to select your task, or 4 to EXIT....
-1
votes
2answers
137 views

How to create a batch file which after some time execute a file but if interrupted execute another?

I want to automate my ms office installation 2007 or 2010 running a batch file. I am thinking having an options menu 1.Office 2007 2.Office2010 When started I want my timer to start..lets say 20secs ...
0
votes
1answer
27 views

Alternative to SWARM FTP batch processing?

In a proposed project the plan is to divide large data sets into chunks, expose them by SFTP into a swarm CPU type of LAN cluster architecture for processing of historical numerical and financial data ...
1
vote
1answer
20k views

Run a batch file from network shared folder depending on MS outlook bit version

Hello I'm trying to figure out on how to Run a file from network, basically it's located from \10.18.xx.xx\installers\install.bat, so yeah It's gonna prompt a username and password when I locate it ...
3
votes
1answer
19k views

Script for renaming files and adding a timestamp (server 2012 r2)

I'm struggling to create a (fairly simple) batch file script that meets these requirements: Looks in the folder called Source for a file (with any name.csv) Renames the file to ...
0
votes
1answer
511 views

unable to start service in remote and local machine with sc command and net command

I am trying to start the services using the below SC command and service is not coming up. sc start startliq_2090 output: SERVICE_NAME: startliq_2090 TYPE : 10 ...
0
votes
1answer
788 views

Batch script with multiple parameters

I am executing a batch script to perform operations on services in a server. so i am giving a ui to user to select a list of services from a server. i cab perform this operation if user selects only ...
0
votes
1answer
45 views

DOS Set variable only available after execution

I have a very simple script that I want to take a value from a text document (single line, one value) and pass it to taskkill - it needs to be a one liner too so I have: set /p pidtokill=<C:\temp\...
1
vote
0answers
1k views

Behaviour of environment variables in HKCU\Volatile Environment reg key

I have a .bat script that runs for every user at login (copies Oracle Java Exception Sites). It copies a file to: %userprofile%\appdata\LocalLow\Sun\Java\Deployment\security\exception.sites ...
0
votes
1answer
3k views

batch file to check cpu and output to txt

I'm trying to write a simple batch file to check the cpu of the computer every 30 seconds and output to txt file with the current time. I want each line to be like: Line1: %time% %cpu% Line2: %time% %...

1
2 3 4 5
7