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
0
votes
2 answers

How to script vpncmd to batch command connect/disconnect?

Here is my connect.bat -----BEGIN------ vpncmd localhost /client accountconnect myConnectionName -----END------ After executing connect.bat, here is the screen result: Connected to VPN Client "localhost". VPN Client> accountconnect…
Level1Coder
  • 245
  • 2
  • 10
0
votes
2 answers

Change Chrome homepage for multiple PC's

In our business we have about 300 PC's. What I want to achieve is to change the homepage on all browsers (IE, Chrome and Firefox). The problem is that I can't find any way to set/change the homepage on Chrome for all computers at once. IE can be…
user201420
  • 1
  • 1
  • 1
0
votes
2 answers

Create a batch file that deletes all user data folders except for All Users and Default User?

I am using Windows XP and would like to create a batch file that deletes all user data folders except for All Users and Default User. How can I achieve this?
Nathan Lawrence
0
votes
1 answer

Exporting Security Group Memberships in Batch

I have the following command but it doesn't work when put into a batch file: dsquery group DC=domain,DC=com -name "Group Name" | dsget group -members | dsget user -display >> "Group Name.txt" If I execute through cmd line it works fine but not when…
PnP
  • 1,684
  • 8
  • 39
  • 65
0
votes
1 answer

Batch script - How to release a locked file for batch 'copy'

A daily windows scheduled task triggers a batch script which moves program files to a folder on a server, using a simple copy routine. rem deploy programfiles copy dailybuild\*.dll "\\myserver\programfiles" /Y copy dailybuild\*.exe…
Kman
  • 101
  • 2
0
votes
1 answer

windows xp batch - check if printer exists

I am looking for a batch-function to check if a printer does already exist on a windows xp system. I made up the following script: set PRINTEREXISTS=0 For /F "Tokens=8 delims=\" %%I IN ('reg query "HKLM\SOFTWARE\Microsoft\Windows…
Zulakis
  • 4,153
  • 14
  • 48
  • 76
0
votes
2 answers

Why doesn't rsync over ssh work when placed inside a FOR loop in a batch file?

I've placed the ff. code in rsync.bat: for %%A in (%VAR_REMOTE_HOST%) do ( set VAR_TARGET=%USER%@%%A:%VAR_TARGET_DIR% echo Rsync Source Dir: %VAR_SOURCE% setlocal ENABLEDELAYEDEXPANSION echo Rsync Target Dir: !VAR_TARGET! endlocal echo…
0
votes
1 answer

How to prevent schtasks on Windows 7 from showing the command prompt after executing a task?

I am trying to get a scheduled task on Windows 7 to execute once a minute, using schtasks and a batch file. My .bat batch file is: @ECHO OFF wscript "c:\http.vbs" The .vbs script si a simple one, it performs a basic HTTP request: Function…
0
votes
1 answer

.bat file - Nagios v3.2 service check and start if stopped

I'm just barely getting into programming so I do apologize for my ignorance. I'm trying to create a .bat file that will check if a service is running on XP Pro. If service is running it will exit 0. If the service is stopped start service wait 10…
LbakerIT
  • 67
  • 1
  • 8
0
votes
3 answers

read an unknown directories name + copy to it

I would appreciate some help please. I am trying to copy two files "test1.txt" and "test2.txt" into an unknown directory, e.g. into the directory "%USERNAME%\Documents\test\04pql7hw.example" The first section of the directory name is a randomized…
Alex
0
votes
2 answers

Batch File to Loop Through Folders and Process If Specific File Found

I have a large number of websites running the same CMS that I want to update as a batch. As the update process just requires copying the updated files into the folder of the given sites, a batch files seems suitable to the task. Is there a good…
Jason C
  • 3
  • 3
0
votes
2 answers

Post-startup & Pre-Login shutdown

Is there a way [using a batch file] that I can set a system to shutdown PRE-login but POST-startup? I've tried a scheduled task to run this batch file with the "/SC ONSTART" flag .. That didn't work. I've tried various registry entries…
Tzadok
  • 3
  • 1
0
votes
1 answer

Parse all text files in a folder using FOR /F command

There are numbers of txt file in a folder. Now I want to open all txt file and print the contents to a single txt file. Condition is, I want to skip first two lines of every txt file. I was trying with following command, but failed. For /F "skip=2"…
Arindam Banerjee
  • 31
  • 1
  • 2
  • 5
0
votes
3 answers

Stop and start batch file every hour

I have a batch script which starts a program that runs in cmd.exe I have tried using task scheduler to create a task which stops this cmd shell and starts a fresh one every hour to no avail. Are there any other ways to stop and start the same cmd…
Shaolin
  • 1
  • 1
  • 2
0
votes
1 answer

MDT task not executing cmd properly

I have done a little experimenting with this task and I have the majority of it working. Basically the Task runs this command line cmd.exe /c set y1=%date:~-4,4%&set m1=%date:~-10,2%&set d1=%date:~-7,2%&set nti=%time: =0%&set h1=%nti:~0,2%&set…
KingBain
  • 31
  • 3