1
vote
1answer
29 views

How to write into a Log file from the batch file?

I have a batch file that triggers process in Access database. I'd like to write into a log file (just some *.txt file saved in the same folder) time when before the process started and after it was ...
0
votes
0answers
17 views

Associate files with batch script [duplicate]

I've got a .bat-file which expects an input file as a command line argument, i.e. script.bat input.key I associated .key-files with script.bat in Windows and I excepted the same behavior like I ...
2
votes
2answers
52 views

Batch File to start .exe when a specific number of files is in monitored folder

I am trying to write a batch file that will trigger an exe whenever there are exactly 4 jpg images in a folder. Afterwards the images should be deleted. I have got it to work it seems, but the file ...
1
vote
1answer
30 views

How to list specific dated folders in a root folder to use with wzzip (winzip) command line in my batch script?

What I am looking to do is, using winzip command line (wzzip) inside my batch script, and zip any folders that have 201409 (That is Sept 2014)(for example) in the folder name into one zip file. There ...
2
votes
1answer
64 views

Windows cmd output redirection to standard input ( >&0 )

From a question on Stackoverflow, i've being testing with redirection from/to stdin stream. And this tests, trying to send data to the stdin stream, just to see what happens, end with an apparently ...
-1
votes
1answer
53 views

How to rename 7-Zip split files as name_00N.zip instead of name.zip.00N

On Windows, when I create .zip split files with volumes less than 20MB with a command like: 7z a name.zip files\* -v20M I get one or more files named name.zip.001, name.zip.002, etc. I need to ...
0
votes
1answer
43 views

.bat file to rename files (not bulk)

I take pictures of airplanes. When i put them on the computer they are named DCS_5678 (or anotrher number :p ) The way i catalogue my pictures is by renaming them as followed: ...
1
vote
2answers
82 views

BAT file: Delete all files in directory older than 5 days except one file

I have a directory with many temp files. All files older than 5 days can be deleted except one file 'DoNotDelete.txt'. Therefore I should add an extra argument to my current script: forfiles /p ...
0
votes
1answer
29 views

Start a program after waiting for user input

I'm writing a .bat file, and I'd like to start a program after waiting for the user to press any key. I tried the command below, but I got and "Invalid syntax" error: timeout /t -1 foo.exe
0
votes
0answers
20 views

Prefix commands in batch

I am using a batch file to run Grunt with some console customization. I was wondering if there is a way to add grunt and a space to the commands I enter into the console. Here is my batch file: CD ...
4
votes
3answers
145 views

Use DOS batch to move all files up 1 directory

I have created a batch file to be executed through the right-click menu in Win7. When I right-click on a folder, I would like the batch file to move all files (excluding folders) up 1 directory. I ...
1
vote
1answer
54 views

How can I move files into a folder based on their name?

I have several .pdf and .tex-files in a certain folder "ABC". They all are named by the scheme C01S02_Word.pdf C03S02SS01_Description_random_words.pdf C04S01SS02_More_words.pdf and so forth C in ...
0
votes
0answers
22 views

How can I start a batch script before open some type of file? [duplicate]

I'm writing some custom lock file system for my company. I want to start my lock_engine.bat before open some type of file. for example here my bat: @ECHO OFF set FILENAME=%~nx1 echo. is locking ...
0
votes
0answers
48 views

Replace “open command window here” to open git sh.exe bash

Is there a way to replace the default option in windows context menu to open command window in the current directory to open git's sh.exe bash in the current directory?
0
votes
1answer
151 views

Windows Batch File (WMI) - taskkill process based on memory usage

Is there a way using WMIC, bat files, or powershell, to kill a task with a particular task name if the amount of virtual memory the process is using is above a certain limit? Specifically I want to ...
1
vote
2answers
169 views

bat file behaves differently when run from windows scheduler

I have a .bat file S:\BACKUP_db\copytofileserver.bat, which takes some files and zip them to the network drive. Its first command is to delete the old backup at specific network path, then pack the ...
0
votes
1answer
45 views

Run a block conditionally on grep output

I've found a number of solutions to this problem, but unfortunately none of them seem to work on my windows box. I'm running a FOR loop in a batch file to loop through a number of text files. For ...
0
votes
1answer
174 views

Windows batch file - How to pipe output to text file and then open the text file?

I have a weird problem where I have a simple batch file that runs another batch file, outputs what is on the screen to a log file, and then attempts to open the log file. The problem is, the log file ...
0
votes
1answer
39 views

Writing time in a file in a for loop

In windows 2008: I'm trying to zip and copy files to a backup server. I use command line/batch file, I log the result in a log file, I now want to log also the time for each file looped. The ...
0
votes
1answer
72 views

Batch Issue - Creating folders and Moving Documents

I’m trying to create a batch script in Windows 7 that will look at the first 6 numbers of 100s of pdf, create a folder based on the 6 unique numbers and move the pdfs into their respected folders. ...
0
votes
0answers
14 views

How to hide cmd window of a Calibre Content Server batch script? [duplicate]

So I manage to be able to share more than one Server Content at the same time with the same PC. If someone want to know how can I do this, is easy. Make a batch script and put this: @echo off ...
-2
votes
1answer
38 views

Loop Counter not working

@echo off setlocal enableextensions enabledelayedexpansion set /a eng_aud_count=0 set /a eng_sub_count=0 For /f "tokens=1-9 usebackq delims=.:^)^( skip=2" %%A in ("MY text File") do ( set trck=%%B ...
0
votes
1answer
79 views

Using a .bat file to pull a string from a text file within a zip folder

So, please bear with me. This is only the second batch file I've ever written and my first post anywhere on StackExchange. I'm writing a batch file that tells a remote server to run HP Array ...
-1
votes
1answer
66 views

What comand do I enter into my batch file to do this?

I want my batch file to find a string in a file and return it to the next line in my batch file. How can I do this? I've googled over and over but can't get the specific answer I need with the ...
0
votes
2answers
124 views

How do I concatenate files using a list and batch?

I need the equivalent of the shell command xargs < list.txt cat -- > compiled.txt as a Windows batch file. There is a directory full of text files (about 50 to 500 files) that I need to ...
3
votes
1answer
216 views

Creating a batch OR .bat file to linearize and merge PDFs using QPDF.exe

I am trying to create a batch OR .bat file that will linearize MULTIPLE PDF files. I already have a script I commandeered that uses PDFTK that sends PDFs to the 'sendto' folder where they are ...
1
vote
1answer
111 views

Opening a text file in notepad++ and refreshing it at regular interval of time using a bat file

i want to open a text document in notepad++ through bat file which i have achieved . this is the command i am using to open a file. %SystemRoot%\explorer.exe "D:\path of file\file.log" Secondly as ...
0
votes
1answer
391 views

Adding prefix to bulk filenames in batch file

Ok so i am trying to add a prefix to all filenames in a folder. After a couple of days of searching the internet I actually came up with something that worked perfectly....almost!!! echo ...
0
votes
2answers
228 views

Move 1 file at a time based off timestamp using windows batch utility

I am trying to build a .bat file to move files from 1 folder into another one, based off of the oldest time-stamped file. Folder 1: Filename: Date Modified: test1.dat 5/12/2014 4:03pm ...
0
votes
0answers
29 views

Get directory by filename

My batch script receives a filename with full path (eg.: C:\...\file.c) as first argument. I need to get the directory of that file and go to the directory, much like: cd C:\...\ How do I do this? ...
0
votes
0answers
196 views

Getting a batch file to run windows 7 psr tool

I'm trying to run the Windows 7 problem steps recorder tool on a remote computer using screenconnect. Screenconnect allows you to quick launch files remotely, so I'm using batch files. The goal is to ...
0
votes
1answer
48 views

how to use Null is Batch script

I working on small program to update the configuration of small program, I'm new to batch script, user need to enter desired input to go to desired program and I have 5 set of programs with in the ...
0
votes
2answers
247 views

Can not schedule a batch file to run at startup [duplicate]

I'm trying to schedule a batch file to run at start up. Here is my command: schtasks /create /tn test /tr c:\simple.bat /sc onstart simple.bat only writes the current time to a file: time /t > ...
0
votes
1answer
57 views

Looping batchfile with counter

Ok, I know the loop part is invalid, but hopefully helps give an idea of what I want to do. Ultimately, I want to get prompted for the 3 values (commented out the prompts for now and hard coding for ...
0
votes
2answers
308 views

Upload the whole directory with ftp from command line [duplicate]

I've got this .bat file: ftp -s:commands.txt commands.txt: open www.domain.nl username password cd path/to/upload/to/ prompt how can I now upload the folder where I ran the .bat to the server? ...
0
votes
1answer
56 views

Suppressing errors from an embedded command in a batch file for loop

I have a batch file that uses the for command to parse the output from another command, but I want all errors written to STDERR to be suppressed. I have tried this: for /F "usebackq delims=" %%a in ...
0
votes
0answers
292 views

Batch file - Copying folders with percentage

I'm currently trying to create a batch file, which actually copy a folder from a server to a clients machine. And I'm playing around with batch file, using xcopy, and it gives me the percentage of ...
2
votes
1answer
40 views

Attempting to end CMD after Batch File

I am running a Batch file on which is located on my DC. explorer.exe = taskmgr.exe end; end; The batch file works fine and does what I need. The thing is that when I run this batch it forces the ...
0
votes
0answers
29 views

How to view file activity (from the command prompt)?

I want to see who recently saved a large number of files to a shared folder on our network, and if I recall, there's a way to print file activity from the last week for example in the command prompt. ...
0
votes
1answer
104 views

Command line - Some questions

I've created a batch file for zipping selected items in a folder. (The file is placed in 'Send to'). If I use the following code: for %%* in (.) do set CurrentFolder=%%~n* "C:\Program ...
3
votes
1answer
555 views

Disable close button on DOS program in Windows 7

At my company we have stores that run some old DOS software. Before Windows 7 you could run these programs in full-screen and now you cannot. I know there are work-arounds to get in full-screen ...
0
votes
2answers
88 views

Windows Command Prompt [closed]

How to load a prewritten line in command prompt? Example: Take the followings as a line: java -jar System.jar Can this command line be written in a .bat file so that by clicking on the .bat ...
1
vote
1answer
526 views

Launch multiple programs in background on windows 8.1

I want to start (launch) three programs in windows and all of them in Background i.e. No windows. I found two ways (both using vb script to hide a bat) Set WshShell = ...
2
votes
1answer
245 views

How to avoid mkdir path redirected to SysWOW64

I'm tring to create some directories (dirs) using a .bat file. At the cmd.exe, I can create the dirs normally, but when runing the commands inside a .bat file, for some odd reason, the dirs are ...
0
votes
0answers
87 views

Runas weird functionality with command line

I have a .bat file I use to launch some programs. Some of them require elevated privileges (i.a. a devcon-based does-device-exist check), but some don't. So, I run the .bat as administrator, and use ...
0
votes
0answers
40 views

How to start an application in a given directory, using other as its working dir?

For a system we are deploying for our customer we need to run the setup executable from %temp% and have it use for the installation, files in another directory. This cannot be solved at the ...
3
votes
2answers
8k views

Batch file with commands to run as administrator and standard user

I'm trying writing a batch file that needs to run some commands using a local admin account (start/stop a service) and some commands using the logged in user (copy files from the user directory) and ...
0
votes
3answers
10k views

Run Batch file as administrator [duplicate]

I created a batch file which stops a service,then stops a process and then starts the service it stopped. When I execute the batch file, it says "access denied". I cannot figure out why it says ...
0
votes
1answer
133 views

Delete a file inside subfolder using bat

I know the name of the subfolder inside which the file I want to delete is located. The name of the subfolder is "My Subfolder" and the file I want to delete inside the subfolder is "The-Bad File.txt" ...
0
votes
1answer
300 views

How to extract part of a string between 2 delimiters, in Windows batch file?

I have a variable length string starting with START and ending with END as delimiters. I want to extract the string between START and END. I tried doing SET _result=%String:~6,-4% ECHO %_result% ...