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.

learn more… | top users | synonyms (1)

6
votes
2answers
294 views

Determine if C drive has 2 GB of free disk space

I am trying to determine if a target pc has atleast 2 GB of free space. Here is what I have so far: @echo off for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='C:'" get ...
1
vote
0answers
24 views

Does anyone have a Windows “at /every:” example to explain how to setup a batch file to run the first sunday of every month? [migrated]

This is the one I have to run first day of the month, but I need to run it the first sunday of every month. at 13:00 /every:1 D:\DBMaintenance\MySc.bat Thanks
1
vote
1answer
74 views

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 ...
-3
votes
0answers
27 views

Next drive letter available after C:

Using a batch script, I want to capture the next existing drive letter after C: into a variable. If none exists, only then assign C: to that variable. I tried the below code, but it shows next drive ...
0
votes
1answer
14 views

Shut down syspro 7 processes

We have nightly backups run on our Windows Server 2012 R2 sys pro 7 server. Having the syspro processes running during backups can cause file lock issues and other errors. Does anyone know a way we ...
1
vote
0answers
58 views

Powershell-Script is not exectued correctly

I have a power-shell-script which is called by a batch-file. The batch calls the script after it has set the execution policy to unrestricted. Currently the script does nothing more than writing a ...
1
vote
1answer
70 views

Disable NIC advanced properties in Windows server 2008/2012

I have some Rackspace VM's and need to disable these advanced NIC properties: Correct TCP/UDP checksum value IPv4 checksum offload Large receive offload Large send offload version 2 TCP checksum ...
2
votes
1answer
96 views

How to remove directories using wildcards by reading a file using batch?

Batch file for /f "delims=" %%f in (7profiledeletelist.txt) do rd /s /q "%%f" PAUSE exit 7profiledeletelist.txt C:\Users\1* C:\Users\2* C:\Users\3* C:\Users\4* C:\Users\5* C:\Users\6* C:\Users\7* ...
1
vote
3answers
380 views

Batch script to export info from Active Directory (name, phone numbers, location, etc) into a csv file

The secretary at my work uses a spreadsheet that lists names, phone numbers, and locations of employees to look up info if someone asks. All this info is located in AD, but the problem is that we are ...
9
votes
5answers
886 views

Program does not run properly as Scheduled Task

Situation I have a batch script that prepares some files, executes a program (.exe) and then deletes said files. This task should run hourly, so I'm trying to configure this using Scheduled Tasks. ...
0
votes
1answer
52 views

get files from a shared folder with password from a anohter computer with batch file

I'm using a .bat file to get some files from a shared folder on another computer in the same network. My challenge is that the shared folder is password protected. Is there a way to write username and ...
0
votes
1answer
71 views

Windows - How to redirect all console output to text file? The console program is called by another software that I can't control

It is a pretty complicated issue (at least for me). GUI software at a given moment, calls console software, which outputs something to console and quits. I'd like to save those results to a text ...
-1
votes
1answer
203 views

Best Practices for User folder permissions [closed]

The following is my bat file. Is there a way I can substitute First.Last with usernames from a CSV file? My boss doesn't want to do all the users at once. He's afraid that something may happen so he's ...
0
votes
1answer
48 views

I am unable to set the owner of a folder back to the user from my bat file

The following bat file is being used to fix permissions for Users in our organization. Everything works perfectly until we try to set the owner back to the user. takeown /F F:\Users\First.Last /R ...
0
votes
0answers
11 views

One location to other location through the move specified files names only

I have so many files move to one location to other location through the move specified files names only . a .txt with a list of name files: 101.jpg 222.jpg 205.jpg etc. ... I need a script that ...
3
votes
5answers
312 views

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 ...
2
votes
2answers
362 views

Batch rename directories with regex via command line on Linux

I have a folder on the server that contains directories that are created daily and are named by date, like so: 07-06-14 08-06-14 09-06-14 etc. At some point I decided that a preferred naming would ...
1
vote
1answer
82 views

if exist !SOMEPATH! not working in batch file

I have a batch script in which i am using multiple if exist statement, the problem is all statements are working except one . Following variables are set SETLOCAL ENABLEDELAYEDEXPANSION SET ...
2
votes
2answers
337 views

simple script to backup PostgreSQL database

Hello I write simple batch script to backup postgeSQL databases, but I find one strange problem whether the pg_dump command can specify a password? There is batch script: REM script to backup ...
11
votes
8answers
2k views

Expire Files In A Folder: Delete Files After x Days

I'm looking to make a "Drop Folder" in a windows shared drive that is accessible to everyone. I'd like files to be deleted automagically if they sit in the folder for more than X days. However, it ...
0
votes
0answers
260 views

Error: “Parameter is incorrect” when opening 0b bat/cmd

Having sort of issue that is more likely annoying when need to create short batch script (though it's not scripting issue). I want to right-click on desktop and create new text file. Rename it and ...
1
vote
1answer
287 views

Running multiple instances of a Batch file in windows simultaneously?

I have a windows batch file that is invoked by windows scheduler. When I try to have multiple windows scheduler tasks trying to run the batch file simultaneously, the batch file is locked by the first ...
0
votes
1answer
661 views

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 ...
0
votes
1answer
116 views

How to use a freshly installed environment variable in Windows

When I set an environment variable through the setx command in Windows 7, the variable is correctly set but if I type in set, it list the environment variables that were set at the script start up, ...
3
votes
2answers
152 views

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

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 ...
-1
votes
1answer
167 views

Space in batch commands (del and taskkill) [closed]

I have a problem using del and taskkill. del D:\New Folder.exe I tried changing the code to this: del D:\"New Folder.exe" That didn't work So I tried this: del "D:\New Folder.exe" Still not ...
0
votes
0answers
176 views

Output results of findstr at a Batch file so they can be read by PHP

I have this Batch file which looks for a string through a the files in the current folder: @echo off for /f %%i in ("*") do ( findstr /m /C:color "%%i" ) Now I would like to output the ...
2
votes
1answer
788 views

wevtutil requires Run As Admin for Security log (but not for System), or how to Run As Admin for Task

I'm using this query to check for certain Exchange account changes on my Windows 2008 R2 AD primary: wevtutil qe Security /q:"*[System/EventID=5136]" /f:text /rd:true /c:1 I'm making a batch file ...
2
votes
1answer
147 views

batch - File last modification time with seconds

I want to know when a file has been modified for the last time. I can get these infos using the following batch script: FOR %%i IN (myfile) DO SET modif_time=%%~ti The problem is that I need ...
1
vote
0answers
189 views

Trying to run a netsh batch with foreign characters

I am trying to run a batch file with the following content: netsh interface ip>set dns "Połączenie lokalne" source=dhcp The file is saved as ANSI. My Windows codepage is 1250, the OEM one 852. ...
0
votes
1answer
592 views

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" ...
0
votes
4answers
3k views

Robocopy fails in Scheduled task with ERROR 1326 Logon failure

My aim: To simply mirror a database backup directory onto another server Approach: Use Robocopy statement contained in a scheduled task robocopy "C:\MylocalDirBackup" "\\MY.IP\DatabaseBackupsShare" ...
0
votes
1answer
167 views

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 ...
1
vote
1answer
122 views

Weird issue with .bat script

I have a .bat script which instals 3 pieces of software. When i open an elevated Command promt , browse to the file and run it everything works fine. When i run the .cmd directly ( using the 'run as ...
1
vote
1answer
2k views

Checking if shared folder exists using CMD

How I could check if network folder shared exists using batch script? Example: \\10.10.10.1\folder1\folder2\shared_folder
2
votes
0answers
269 views

Access Denied error when running xcopy in jenkins on windows 2008 r2

I have installed Jenkins on a Windows Server 2008 R2 and in the build script i use xcopy to copy the generated war file to a specific folder The problem I am having is that every so often the build ...
1
vote
1answer
276 views

windows xp - how to add a ipp printer by batch/vbs

I need to deploy printers using IPP in the logon script (batch/vbs). I found the following script to do this: rundll32 printui.dll,PrintUIEntry /if /q /b "r011-printer01 " /f ...
0
votes
1answer
459 views

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 ...
1
vote
1answer
1k views

rsync unexplained error & received SIGINT, SIGTERM, or SIGHUP

I created a batch script to back-up our server: #!/bin/bash user=$1 # create user dir ssh root@local.backup.tst -p 5774 mkdir -p /var/backup/server.tst/incremental/$user # backup mail dir rsync ...
-1
votes
1answer
184 views

portqry to check connectivity

Is it possible to check the connectivity between 2 remote servers using portqry given that the portqry.exe command is executed on another server. for example, check the connectivity between serverA ...
1
vote
2answers
88 views

computer startup script reporting success to a server

I am using Group Policy to deploy a computer startup script that tries to uninstall one program and install another. I need this script to report its status (whether a certain file exists on the ...
0
votes
2answers
106 views

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 ...
0
votes
1answer
610 views

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, ...
1
vote
1answer
368 views

Batch script to create home home directories from list of names

I'm trying to create a home directories with permissions from a text file. I can only get the batch file to run the first line. Can anyone tell me why? I initiate the scripts by running go.bat as ...
0
votes
1answer
372 views

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

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 ...
0
votes
1answer
1k views

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

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 ...
0
votes
0answers
74 views

Batch script terminates too soon

I need some help with Windows batch/CMD scripting. I wrote a script to record mic-in to a MP3 for 12 hours. It runs ok when running it manually. It will run with task scheduler too - just that, ...
0
votes
3answers
654 views

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 ...