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.

This was the first extension used by Microsoft for batch files. This extension runs with MS-DOS and all versions of Windows, under COMMAND.COM or cmd.exe, which execute its commands, normally line-by-line.

339 questions
4
votes
1 answer

Batch script to test if a folder exists fails when checking a UNC path

I've written a small batch file to help us with a server migration to remap user directories using GPO. However in the batch file I'm having a syntax problem that appears right but it's still failing. Here is what I have so far below. If exist…
Chad
  • 41
  • 1
  • 1
  • 2
4
votes
1 answer

How to restart atd without affecting running jobs?

Does anyone know how to restart atd without affecting current running (batch) jobs? I guess I could move the jobs out of the spool directory and wait for the current running jobs to finish, but I'm curious to hear.
Ztyx
  • 1,385
  • 3
  • 14
  • 28
4
votes
3 answers

keep command window open after running bat file

i have a bat file that has the following it: sm start "Schedule" this code runs but the command window closes immediately what can i put inside the bat file to keep the window open?
Alex Gordon
  • 455
  • 3
  • 14
  • 31
4
votes
6 answers

Is there a way to submit a batch of commands to a Cisco router and have them execute from the router?

I need to change the configuration of a remote (6 hours' drive) client's Cisco 871 (IOS 12.4.15T) from my location because of some new internet service at his location. To be more precise, I need to change the default route, ip address of the…
atroon
  • 508
  • 3
  • 10
  • 23
4
votes
7 answers

Batch scripting: iterate over drive letters?

In windows batch scripts, how can I iterate over all drive letters which correspond to physical volumes or mapped shares?
kdt
  • 1,400
  • 3
  • 22
  • 34
3
votes
1 answer

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 the code: @echo off setlocal…
3
votes
1 answer

Getting error 1219 while there are no other sessions

PC's in our organisation run Windows 10 Pro and are sometimes shared between users (local accounts, no domain and AD). I have written a batch script that users execute when mounting our network shares to a drive letter. Most of the time it runs…
Edwardo
  • 31
  • 1
  • 4
3
votes
1 answer

Trouble using powershell output as a variable in batch file

I can manually run this command from a Windows Command Prompt: powershell (new-timespan -start 01/01/2000 -end (get-date)).days % 14 And it returns a number from 0 to 13. I want to use this result in a batch file, but this line gives an error…
pigeonpigeon
  • 33
  • 1
  • 3
3
votes
1 answer

Windows Sensu client - occasional "Access is denied" errors when running batch files

We have the Windows Sensu client running on several 2008 R2 systems. One of our checks calls a batch file to gather some info and report back. We are sporadically receiving "Unknown: Unexpected error: Access is denied (5)" messages for these checks…
Dan
  • 1,278
  • 18
  • 27
3
votes
1 answer

Why does scripting with appcmd behave differently than using IIS GUI?

I've scratched my head raw on this. Please help me stop the scratching. We have a manual workaround for a site problem we're experiencing. The workaround always works when we do the steps manually, but running a script that does the same steps…
biscuit314
  • 113
  • 9
3
votes
5 answers

Web interface for torque

Can someone recommend a good web interface for Torque? I'm interested mostly in monitoring the status of the job queues.
Lorin Hochstein
  • 5,028
  • 15
  • 56
  • 72
3
votes
1 answer

Can't run .bat file off share, but can from cmd

I have a smb share on a Linux box set up that I can view in explorer: \\XXX.YYY.ZZZ.QQQ\Share In this share is a batch file: \\XXX.YYY.ZZZ.QQQ\Share\Scripts\Script.bat I can open the file in Notepad from Explorer, using right-click "Edit", and even…
Benjamin Peikes
  • 1,094
  • 3
  • 16
  • 26
3
votes
5 answers

del *.txt removes also file.txt_backup

Imagine that we have directory c:\test with following files: first.txt second.doc third.txt fourth.txt_bak I want to remove only txt files, but leave doc and txtwhatever untouched. When I run command del c:\test\*.txt, it removes everything except…
Artur Iwan
  • 133
  • 5
3
votes
2 answers

Adding numbers stored in variables in windows batch script

I have a loop in a batch script and I would like to do some arithmetics with the loop counter. I found out how to evaluate expressions, how to add numbers here: Evaluating expressions in windows batch script How do I do the same but with…
raoulsson
  • 4,763
  • 10
  • 34
  • 29
3
votes
2 answers

Make windows all in capitals for specific application

Is there a method where I can set windows transparently to caps preferrably when a specific application is run. For bonus points, I should be able to revert back to normal (non capslock mode) when the application is terminated. I googled and went…
SteveMustafa
  • 429
  • 1
  • 5
  • 11
1 2
3
22 23