bat

Windows batch file 'del' not working

I am trying to do the following in a batch file on Windows 7: del "./cfg/config.cfg" del "./cfg/server_blacklist.txt" I tried these variations too: del ./cfg/config.cfg del ./cfg/server_blacklist.txt del "cfg/config.cfg" del "cfg/server_blacklist.txt" del cfg/config.cfg del cfg/server_blacklist.txt Without using the "-characters ...

Compiling multiple LaTeX files in Windows

I have a folder with many LaTeX files that all use the same custom LaTeX class. Now I want to recompile all of these LaTeX files. They are aranged in separate folders with the same name for the main files as the folder, e.g., foo0001/foo0001.tex, foo0002/foo0002.tex. Is there a way, using a Windows bat script, to compile/build all thes...

how to read registry string value from batch file

Hello I want to read registry string value, from bat file, and then assing the readed value to variable. I tried the following : FOR %%a in ('REG QUERY HKLM\SOFTWARE\MathWorks\MATLAB\7.10 /v MATLABROOT') DO set MATLAB=%%a echo %MATLAB% but it doesn't work. ...

Batch file programming: problem with variable

SET SS_SOURCE_PROJECT = sausages @echo SS_SOURCE_PROJECT = %SS_SOURCE_PROJECT% This isn't working, it just outputs: SS_SOURCE_PROJECT = But I am expecting SS_SOURCE_PROJECT = sausages This is on WinXP if it matters. What obvious dumb thing am I doing wrong? ...

Same FOR Loop acts differently (WinXP)

I am trying to write a batch script with a section that ouputs your drive mappings to a text file, so i can restore it later once i wipe out the machine. I came up with this for loop to do it, but its acting differently when its a batch script versus running the command itself. This is the actual line of code: FOR /F "tokens=1,2" %i in...

Batch with No args runs as job (scheduled task) with no errors, Batch with 1 arg fails with Access Denied. Why?

Here's a trivial batch: @echo off if not .%1==.-b goto else echo Running with -b flag ON goto endif :else echo Running with NO flags :endif Now, trying to run this from a scheduled task on a Windows Server 2003... If the task is ran like: "C:\Test\test.bat" then the log (Schedlgu.txt) says: "Test Job.job" (test.bat) ...

DOS Batch file issue with ampersand & in an input record.

I've creating a dos batch file to process a file of input records. I've cut out the majority of the code, so here is the problem. When it reads the 3rd record, with the ampersand, the job does not write the output record, UNLESS i put double quotes around the %%H variable. However, when I do this, it adds the " to the first and last b...

Script for add route

Scenary SO Windows 7 I need to connect to remot host via cisco vpn. Sometimes the host destination network is the same of local network. Example (Partial output of ipconfig command): Ethernet adapter Cisco Vpn Adapter: IPv4 Address. . . . . . . . . . . : 192.168.100.12 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Wireless...

Running rake from batch file

When I run rake from within a batch file (.bat) it will exit immediately after the rake script has completed and will not execute any commands after it. e.g. for the following, it will execute rake but not change directories rake cd .. Anyone know how to stop this behaviour? ...

Batch script command add/change number # in variable name

I have problem with "%_Link%%num%" its not working show up link after load from txt format. I think "%_Link%%num%" is wrong syntax function. but I know %_Link1%,%_Link2%,etc can work... but i want loop that will add/change number # in variable name like "_Link#" changeable number as #. here code below... TEXT FORMAT (NOTEPAD): http://w...

using 'set' variables that are gawk one liners

i am writing a short bat file that contours a xyz file with GMT utilities (generic mapping tool) i want to read the max and min file and use it later in the bat file what i did is set max_color=gawk "BEGIN {max = 0} {if ($3>max) max=$3} END {print max}" %file% set min_color=gawk "BEGIN {min = %max_color%} {if ($3'<'min) min=$3} ...

Bat: how to extract filenames of a command

Hi I am trying to create a script listing the names of the files return by a program. The program is called ShowFiles.exe and it takes to arguments like this: "ShowFiles opened ..." so argument 1 is "opened" and argument 2 is "..." The the result looks like this: c:\tmp\test1.txt#0 - add default c:\tmp\test2.TXT#1 - edit defa...

DOS BAT file equivalent to Unix basename command?

Is there an easy way to get to the basename (file name without extension) of a DOS file name using the DOS BAT command language? I agree: format c:\ is probably a good start, followed by a bootable Linux CD (assuming these antique machines have a CD reader - not a given). But let's pretend that we only have DOS... (That means: not Win...

script, bat to monitor if a user is locked in active directory Windows.

Hi, there is a method to implement this functionality for monitor an specific user in active directory to check if this is blocked.(And if this is locked , unlocked this user automatically) Is a common user, that get blocked frecuently. Or there is a possibilty for avoid the "3 tries for login and then lock" for this specific user. I...

How to make a program that automatically synchronizes

Hey i am hoping to write a program where the program automatically just copy pastes all my dad's documents from D:\office folder. So whenever I plug-in my pen-drive , the program silently copies all documents inside my pen-drive. Also all files should be pasted to a hidden folder in the pen-drive (so it remains private) . Synchronizatio...

How to parse system time to the input of a program

An alarm program @echo Off :alarm start music.mp3 cls goto alarm How to take/parse system time so that I can make it start alarming at every 15 min or every 1 hour? A complete code would be appreciated. ...

Assigning newline character to a variable in a batch script

Hi, The following is the batch script i have written @echo off setlocal enabledelayedexpansion set finalcontent= For /F "tokens=1-2* delims= " %%I in (abc.txt) do ( IF %%J EQU MAJORVER ( set currentline=%%I %%J %1 set finalcontent=!finalcontent!!currentline! ) ELSE IF %%J EQU MINORVER ( set currentline=%%I %%J %2 set finalcontent=!fina...

How to call two batches from a third one?

When my Windows Batch file (.bat) calls other two BAT files it exits after the first one. How to make it run both of them? ...

How to use REG_EXPAND_SZ from the commandline?

Hi, I was reading the Windows Commandline Documentation (Win+F1) about the commands that modify the Windows registry, particularly the the "reg add" command. reg add HKCU\testfolder /t REG_EXPAND_SZ /v Stokrotka /d "%systemroot%\system32" Now, I don't know how this was designed to work. When I invoke the command above, the variable %s...

IF ELSE problem COMMAND BATCH

I have problem about IF ELSE in Command Batch script... In Notepad: Code: :CHECKACCOUNT if /I "%user%"=="insertusername" ( GOTO :ACCOUNT ) ELSE ( GOTO :CHECKPASSACCT ) :CHECKPASSACCT if /I "%pass%"=="insertpassword" ( GOTO :ACCOUNT ) ELSE ( GOTO :COUNTER ) In COMMAND: Code: ( was unexpected at this time. FULL Script Code: @ec...