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)

0
votes
1answer
764 views

How do I delete a remote file using NCFTP (Windows client)?

With ncftpput.exe how do I delete a remote file once logged in? I have tried using the -W option to send a Raw FTP command but cannot get it to work. Has anyone got a working example? Have tried ...
0
votes
1answer
19 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 ...
0
votes
1answer
699 views

Server 2008 issue running batch file

For the life of me, I can't seem to get a batch file running in Server 2008 Task Scheduler, despite it not having the common problems I've seen before. Problem so far: I have a batch file that ...
-1
votes
1answer
37 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
0answers
34 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
7 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 ...
6
votes
2answers
5k views

Locale-unaware %DATE% and %TIME% in batch files?

The %DATE% and %TIME% environment variables provide the current date and time on Windows machines on the command line and inside a batch file. Sadly, those values are locale-aware! Meaning that, say, ...
-4
votes
0answers
81 views

How to write batch script for App server which will make output a file on to SAN

We have a batch Script with the name “boo.bat” which is trigger by the MainFrame Job say name “M” The batch script is written below which checks if Mainframe system is able to connect our App server ...
3
votes
5answers
288 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 ...
1
vote
1answer
2k views

check for ping reply - unexpected result

I am running this within windows xp batch file: ping -n 3 10.1.1.2 >nul: 2>nul: if %errorlevel%==0 ( echo ping reply arrived ) else ( echo no ping reply. ) sometime, it seems ...
28
votes
3answers
51k views

How to sleep in a batch file?

How to pause execution for a while in a Windows batch file between a command and the next one?
11
votes
8answers
1k 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 ...
2
votes
2answers
214 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
822 views

Migrating ODBC information through a batch file

I am a desktop support technician currently working on a large scale migration project across multiple sites. I am looking at a way to transfer ODBC entries from Windows XP to Windows 7. If anyone ...
1
vote
1answer
44 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
89 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 ...
1
vote
2answers
1k views

How to “ignore” username and password prompt in net use

I have at the moment a logon.cmd script, that I'm using to map network drives to the users profile. It looks like this: ::Onboarding net use m: /delete net use m: \\BOB\onboarding ::Bookings net use ...
0
votes
0answers
105 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 ...
0
votes
3answers
1k views

Autostart Cygwin on Windows boot and run a cygwin command

Sometimes my Windows server reboots at night to install new updates. Then the next day I find out that my cygwin instance has been stopped. What I want is on Windows start, also run Cygwin AND run a ...
1
vote
1answer
151 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
2answers
743 views

Remote GPO through BATCH Script exiting

Right so, I'm trying to make a remote GPO script that from one of our management machines will push the GPUPDATE command to certain servers. After some googling I found a script that I tried to ...
4
votes
5answers
1k views

shortcut for Eventvwr > Connect to another computer

I was wondering if you can write the following action in a batch command? eventvwr (open the event viewer) Menu Action > Connect to another computer Type in the name of the computer. Connect. This ...
0
votes
1answer
201 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 ...
12
votes
3answers
54k views

For Loop counting from 1 to n in a windows bat script

I need to run a windows command n times within a bat script file. I know how to do this in various programming languages but cannot manage to get it right on the windows command line :-( I would ...
0
votes
1answer
63 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, ...
2
votes
0answers
201 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 ...
0
votes
13answers
29k views

Finding day of week in batch file? (Windows Server 2008)

I have a process I run from a batch file, and i only want to run it on a certain day of the week. Is it possible to get the day of week? All the example I found, somehow rely on "date /t" to return ...
3
votes
2answers
132 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
278 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
83 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 ...
2
votes
1answer
82 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 ...
0
votes
0answers
107 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
432 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 ...
0
votes
4answers
17k views

Command Line Winrar & Batch Scripts

I've written a wee batch script to backup some stuff on my desktop and dump it over the network to a share... The only thing that's bugging me is the verbosity of rar.exe while it's doing the ...
19
votes
4answers
60k views

Get directory containing the currently executed batch script

I use %0 in batch file to get the containing directory of the batch file but the result is :- c:\folder1\folder2\batch.bat I want just directory, without batch file name, like this :- ...
1
vote
0answers
133 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
0answers
93 views

Archive IIS logs batch script

I have created the following script: forfiles -p "C:\Users\My_user\Desktop\wwwLogs" -s -m *.log -d -7 -c "cmd /c 7z a -mcu -t7z -r C:\Users\My_user\GNS3\myzip.7z @file" & forfiles -p ...
0
votes
0answers
17 views

Add contact to SBS 2003 active directory remotely

Masters, We need to often add or remove contacts in active directory. It is possible to delegate access to a user (with or without administrative rights) to do this remotely (without log in via ...
0
votes
1answer
231 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
2answers
2k views

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

How to put DayOfWeek value into file name?

I would like to use the numerical part of the output of "wmic path win32_localtime get dayofweek" to number backup files. Something along the lines of: FOR /F "tokens=2 delims=\n" %%DoW IN ('wmic ...
0
votes
1answer
119 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 ...
0
votes
2answers
3k views

How can I find multiple values from windows command line output?

Example, to see if KB983590 is installed: systeminfo | find "KB983590" But what if I wanted to find out if more then one KB was installed?
8
votes
5answers
15k views

How do I extract all archives in the subdirectories of this folder?

How do I extract multiple archives in contained in subdirectories in a folder, outputting the results back into the folders where the archives are.
1
vote
1answer
98 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
1k 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
0
votes
1answer
165 views

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

Create Batch file to execute multiple batch files and VBS files

I have multiple batch files and vbs files , when i try to create a batch to call them it stop after the last batch file and dont execute the vbs. without giving any error if i put the vbs at the ...
0
votes
0answers
61 views

After setting file association with FType, images still launching in other program

I'm aware of how to use Assoc and FType to set the default program that a known file extension will launch in. I need to create a simple batch script to re-associate all of the image file extensions ...