Text file containing a sequence of commands or program invocations.

learn more… | top users | synonyms (1)

2
votes
1answer
186 views

Copy/move certain file types from subfolders to a common folder

Situation: Numerous sub-folders with random folder names containing several files with random names. Some I want to retain, others can be deleted. Goal: Move the files with extensions: *.exe *.pdf *...
2
votes
2answers
146 views

Fractions in Batch

Why does the following code return 0? @echo off set a=100 set /a a=%a%*(50/%a%) echo %a% pause I assume it's because batch at some point evaluates (50/100) as 0.5 and rounds it down to zero ...
2
votes
1answer
652 views

Count number of lines in file using batch

I am using TrailerCount.bat file to count the number of lines in text file using below mentioned code @Echo off ::set newline=^& echo. SET FilePath=%1 Set /a _Lines=0 For /f %%j in ('Type %...
2
votes
4answers
176 views

Batch file. Variable in variable

How to use variables in variables? This code: set newvar=%var%var2%% doesn't work. So, what to do? I can't write my program without it.
2
votes
1answer
170 views

What persistent information does the devcon hwids output contain?

I have a gaming keyboard (Logitech G15) that uses its own software for additional features. Now I am writing a startup batch script that starts that software if the keyboard is connected. It of course ...
2
votes
2answers
3k views

how to access variables that are set in a different windows batch file?

i have a windows batch file - called fileA.bat, which contains a variable set in it. Sample code of fileA.bat: set fileA_username=michael now i have another batch file, called fileB.bat, which ...
2
votes
2answers
3k views

Detecting computer name

How can I detect if I am on a certain host computer in a batch script? Ex if I run the command hostname it gives me the current computers hostname. Is there a way that I can save that to a variable or ...
2
votes
2answers
5k views

Delete all files older than 365 days, but exclude certain folders

Edit: After @Mbu answer I realized that my first approach with leading numbers in folders as criteria to exclude isn't the right way. I decided to use a fixed list of folders to exclude. I want to ...
2
votes
1answer
1k views

Install TortoiseSVN with a batch file

I am looking for a way to install TortoiseSVN via a batch file in order to automate the process of setting it up on several Windows machines. Is it possible to do that maybe with the official ...
2
votes
2answers
14k views

Trying to read a text file content and set variables values from that

I have a batch file that creates a text file with its output like the following: RESULT=0&SECURETOKEN=SmH3kciXiVkiwD0i70CwKYgAR&SECURETOKENID=2013031414280240&RESPMSG=Approved The ...
2
votes
2answers
1k views

Is it possible to have scripts that trigger whenever an IM is received in Microsoft Lync?

I've just upgraded to Lync 2013, and I'm considering using it instead of Pidgin+SIPE. One of Pidgin's many nice features is Growl integration... and I would miss that. There are no Growl plugins for ...
2
votes
1answer
1k views

How can I add a value to the registry via command line without a .REG file?

I have a need to add my external IP address to the Windows registry on a scheduled basis, and I want to do this with a bat/cmd file to automate the process. I was able to use the advice from this ...
2
votes
1answer
24k views

Pass a path with space to a batch file as a parameter

In first.bat, I use var5=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\ CALL scripts\vc64.bat %var5% And in scripts\vc64.bat, I use SET var6=%1vcvarsx86_amd64.bat CALL %var6%...
2
votes
1answer
2k views

Open multi files with batch file

I have a trouble when I open multi images with Irfanview . It only opens one file, and after I close the window, it opens next one. I want to open three windows instantly. I hope someone help me out. ...
2
votes
2answers
7k views

How do I copy recent folder/files from a network drive using a batch file?

My question may have answered someway or other but unfortunately I did not get the exact answer that I was looking for. Here is what I'm trying to do- create a folder on pc1, c:\temp1 map a network ...
2
votes
2answers
11k views

'C:\Program' is not recognized as an internal or external command

In Win 2003 I execute command "C:\Program Files\Windows Resource Kits\Tools\robocopy" "q:\SQLBackup" "\\SQLBackups\MyDB" /Z /S /MIR I am getting an error: 'C:\Program' is not recognized as an ...
2
votes
1answer
1k views

Batch files can not be a passed a path with spaces when it is elevated

I am trying to create a batch file that needs to be passed a path and has operations in it that requires elevation (I use mklink in it). Here is how to recreate the problem. Make a .bat file that ...
2
votes
3answers
888 views

What kind of window's batch file allows zipping of ftp files?

What commands should I use to transfer a file via FTP and then compress the files in a backup directory with a filename containing the date/time for reference? I'd prefer to use batch scripting. The ...
2
votes
4answers
4k views

Batch file to backup and change environment variables

How do I write a batch file that backs up and restores the environment variables. After that, I want to set some of the variables and if something goes wrong, I can rollback the changes with this ...
2
votes
1answer
700 views

How can I get the image dimensions of a TARGA file through a batch script?

Does anyone know of a command/hack/anything that will give me the dimensions of a TARGA image file in Windows XP? So far my searches have only turned up either how to resize an image through a batch ...
2
votes
2answers
6k views

Running a powershell script using a batch file (.bat)

Currently this is my path for launching VMware vSphere PowerCLI command prompt. I wish to run my sample.ps1 script automatically using a batch file. How can I incoporate sample.ps1 into this path and ...
2
votes
3answers
446 views

runas domain access?

I want to execute a file on a share but I need to use a domain account to access it. I've tried runas /user:domain\user \\someshare\foo.exe. It prompts for the domain account's password, which I enter,...
2
votes
1answer
2k views

execute batch file in invisible mode [duplicate]

Possible Duplicate: Run a completly hidden batch file How do I execute batch files at startup so that I won't see the cmd like black window. I have this batch file which I use to attach vhd ...
2
votes
1answer
39 views

Windows batch: Get the first folder name starting with some value?

I have a batch file in which I pass the name of the folder I want to use as a argument. But now I want to make it a little smarter by letting the user specify only the first few characters of the name ...
2
votes
2answers
34 views

Nesting IF in Windows Bat file

I am having some difficulty in understanding how the Nested IF works in windows .bat script. What I wish to achieve is as follows. I shall be passing two parameters to a bat file IF first parameter = ...
2
votes
1answer
83 views

Check if a process is running or not continually, and start multiple programs if not and terminate itself

I found this at stackoverflow and it's code is this:- @echo off Set "MyProcess=calc.exe" echo "%MyProcess%" tasklist /NH /FI "imagename eq %MyProcess%" 2>nul |find /i "%MyProcess%">nul If not ...
2
votes
1answer
53 views

If then statement in the for loop

I'm nebiew for windows scripting. My scripts would seachs string in the file, if counted the string and checking return code in if then else statment. But, I have question, some error on if then ...
2
votes
2answers
1k views

find a directory and opening it in Windows with cmd

is there possibly any way to find the directory of a file ("example.txt") and then if it finds the file open the directory (such as "c:\example\sub\") on cmd (or vb)? of course looking in all the ...
2
votes
1answer
2k 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 ...
2
votes
2answers
18k views

How to send mail from a Windows batch file

I want to send a mail from a Windows batch file. Here is my code: blat test.log -server smtp.gmx.com -to dest@gmail.com -f address@gmail.com -s "test mail" -u "address@gmail.com" -pw "password" -...
2
votes
2answers
376 views

Speed up file search in a network path

I am trying to search in a network path inside a folder of 152.000 documents, list of files to be searched is 1500, after 5 hours it has only found 50 documents. This script was written by another ...
2
votes
2answers
8k views

What causes SVN “Working copy <path> is locked”?

I wrote a console application that uses SharpSVN to update 3 folders in my repository. Wanted to convert that to a batch script to removed the dependency on SharpSVN. Came up with this: CD C:\...
2
votes
1answer
116 views

Which program should a batch script with extension .bat be associated with in XP sp2?

For some reason or other my .bat files are associated with notepad and will therefore not run. Looking for answers, I have only found solutions for systems other that XP. Assistance would be greatly ...
2
votes
2answers
979 views

Cannot delete hidden file on network drive using DOS / batch script

I am trying to delete a file from a mapped network drive, I: In my batch script, I have: del /f I:\bin\.hiddenfile When I run the script, I go to the directory I:\bin and see that .hiddenfile is ...
2
votes
1answer
535 views

Capturing output of .bat script in VMWare Fusion 'runProgramInGuest'

I've recently started a new job where we run virtualized copies of Windows inside VMWare Fusion (Mac OSX is the host). Among other things, we have a few utility .bat files that get run regularly. I'd ...
2
votes
2answers
797 views

Windows script to run as a batch to replace character in list of file names

I have 4 files as below: C:\Documents and Settings\vm\AC R\test JE.BOS.20130516.CSV JE.BES.20130516.CSV KFROPN.SAVEFILE.CSV KFBAD.SAVEFILE.CSV I have to replace "." in the filename with "-". But ...
2
votes
1answer
781 views

How do I replace text inside a FOR command?

Inspired while writing my other question (which i now deleted) (sometimes talking to the duck does help) I think I found a solution to my problem but I don't know how to do it. I have the following ...
2
votes
1answer
63 views

command line with spaces

I want to do a command line like: for /F "tokens=4" %%F in ('c:\spaces spaces\filever.exe /A /D D:\Spaces Other\a.dll') do (set VERSION=%%F) I encounter a spaces problem. How can I write that ...
2
votes
2answers
1k views

What is the command to check if a command's results mention OK?

Alright, so I was playing around with changing MTU size and wanted to make a batch file to automatically lower it and then raise it later. This is probably simple, but I just can't figure it out. ...
2
votes
2answers
795 views

Is there some way to universally address the default Program Files folder in Windows 7/2008 via .BAT file?

I'd like to write a batch file, where some commands target items in the Program Files folder, that is naturally cross-compatible from Windows XP up to Windows 7 x64 and Server 2008 R2. However, the ...
2
votes
2answers
1k views

Variable Names Between Called Batch Files

Let's say I have two batch files, foo.bat and bar.bat, that are located like so: root\foo.bat root\grub\bar.bat Let's also say that both files contain a line that sets a variable, like so: set PWD=...
2
votes
3answers
5k views

Batch detect Adobe Reader version on multiple computers

I want to scan for and build a list of versions of Adobe Reader installed on computers at one site in a domain. I'm using a demo of Shavlik Netchk (commercial software) which works well, but I'm ...
2
votes
1answer
1k views

Batch file close/kill a System Tray/systray program

I use a program for hosting multiple forms. Each form leaves a systray program of said program. In Processing they all use the same same. But Window wise/mouse over name while in tray they use the ...
2
votes
1answer
1k views

PowerShell or batch script to delete with exclusions

What's a good way to delete everything below a certain path, supplying a list of exclusions? E.g. C:\ MyFolder MyApp MyConfig MyWorld MyEverything ...
2
votes
1answer
1k views

Use a batch file to kill LogMeIn Free?

When I connect to my media PC using LogMeIn Free, Windows 7 Media Center shuts down because it doesn't work over a remote desktop connection. This isn't too much of a problem for me as it's the same ...
2
votes
1answer
53 views

Searching through a txt file and printing next word of a string

I have a batch script which will print the entire line of search string into a text file. for %%i in (configure.txt) do ( FINDSTR /C:"Widget Name=" %%i >> output.txt ) Here is how my ...
2
votes
1answer
35 views

Remove lines form txt file if specific string is found

I can not figure out how to remove a specific line with my batch script for the out put is: type: MD2 status: granted date: 2016/03/11 type: MD2 status: detached date: 2016/03/11 if the status is ...
2
votes
1answer
99 views

Batch command delete from list of files from multiple computers

Currently I use a poor piece of programming where I delete multiple files on multiple PC's. What I would like to do is have a file with the names of the PC's (PC.txt) and a file (filedel.txt) with ...
2
votes
2answers
158 views

End Remote Desktop Session and Standby

I've setup remote access on my computer (Windows 7 Pro x64 via RDP). The [WOL] wake-on-lan function is already working so I can wake it up from sleeping. When I end a remote desktop session (start-...
2
votes
1answer
78 views

Windows UnRar Batch script need to ignore .part02.rar through part99.rar extensions

I have two windows batch scripts that both work to recurse the folder they are placed in, and extract every .rar file into the folder of the rar files. however when a folder uses the structure: file....