batch-file

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

Get Value of Registry Key

Hello all, I have a batch script that checks if a registry key exists and if it does exist then open Internet explorer. What I now want to do is get the value of that registery key and put it in the URL. How can I do this? @echo off reg query HKLM\Software\Test\Monitor\Settings if errorlevel 1 goto not_exist goto exist :not_exist :ex...

ZP4 adress parsing batch script

How do I create a Windows script that executes the command C:\ZP4\AUTOFIXD C:\FOLDER\PARCELS.DBF \HOME\LIST.LAY SKIPFIRST UPLOW for any and all PARCELS.DBF files that might be in \FOLDER\ and all subdirectories. Ie, the script would be equivalent to C:\ZP4\AUTOFIXD \FOLDER\PARCELS.DBF \HOME\LIST.LAY SKIPFIRST UPLOW C:\ZP4\AUTOFIXD \...

Batch: Remove file extension

I have the following batch script from Wikipedia: @echo off for /R "C:\Users\Admin\Ordner" %%f in (*.flv) do ( echo %%f ) pause In the for-loop all files with the extension flv get echoed, but I want the make some actions with the file(s) where I need one time the file without the extension and one time with the extension. How...

Batch: Remove a string from a string

I have the following batch script from Wikipedia: @echo off for /R "C:\Users\Admin\Ordner" %%f in (*.flv) do ( echo %%f ) pause I learned here that %%~nf returns just the filename without the extension. Now I just wanted to remove (Video) from the filenames (%%~nf). How could I do that? ...

Plink command is invalid to cmd.exe

I am trying to throw a plink command to my esx server and grep the linux output of the command. The code above does not work. But if I remove the | grep part it works again. Is there any other way to achieve the same results but making the command passable with cmd.exe? FOR /F "TOKENS=1 DELIMS=:" %%A IN ('TYPE %SYSTEMDRIVE%\Users\Ian\De...

TaskKill for killing .NET console application

I have a bunch of console host applications hosting WCF services. I'm calling a .bat file as a pre build step to kill any running host instances so that I don't get WCF channel registrations errors(manually killing the console hosts each time before a build is a royal pain). The .bat file I've created contains the following. taskkill /...

How to run and hide using Batch File?

I'm running a script (MouseParty.pie) on Glovepie. This is my batch file script, it runs MouseParty on the GlovePie IDE... .\\glovepie.exe -MouseParty And now, I need to hide the GlovePie IDE. Any idea on how to do that? Plus, if you can tell me how to run MouseParty when it's in another folder that would be really helpful. And if ...

Text-based loading bar when running Java in command prompt?

Hey everyone, I was just wondering if there was a way to use System.out.println(); or other methods to create a cool loading bar when I run my program with a batch file. The real question here is how I can make this bar appear as if it's printing on only one line. I don't want it to be spread over multiple lines like below: [aaaaaccc...

%CD% variable behaviour differs when right click and use run as admin

I have a windows cmd file that is making use of the %CD% environment variable to determine the execution directory of the cmd file. When I run the cmd file from the command line it works correctly, meaning that the %CD% variable contains the working directory. If I double left click the cmd it also works as I expect. However if I right ...

Batch file - Write list of files to variable

I'd like to get a list of all files (including their absolute path) into a variable, separated by spaces. My Google-fu seems to be weak in this regard, because I keep running into issues. I have a base directory stored in %baseDir%, and would like to parse it for files (not recursing or including sub-directories). Like I mentioned, th...

robocopy can't find newly zipped file for copy

I am working with a batch file that is being use to copy files from several remote servers to one central repository using robocopy. I am trying to zip the contents of the folder and then copy it but robocopy then returns the message: "Warning: name not matched: z:\ExamplerServer\folder1 Error: No files were found for this action that ...

Parameter Not Applied when Executing sqlcmd from CruiseControl.NET

OK, so here's the scenario. CruiseControl.NET (Version : 1.5.7256.1) runs a project to rebuild a database. The CruiseControl.NET windows service is running as a windows user we created for CC.NET. There are several tasks in the project but they all run fine. However, one of the tasks that runs is a console based utility I wrote in C# th...

Batch file with variable number of command line parameter

I have a following batch file: :LOOP ping %1 ping %2 goto LOOP The above file works only with two command line parameters. How to make this work of variable number of command line parameters. For example if four command line parameters were provided at the run time, then it should ping all the four servers. Any help appreciated ...

IF EXIST C:\directory\ goto a else goto b problems windows XP batch files

Hi whenever i run the code below it occurs to me I have made a mistake using the if exist lines, as no matter whether the directory exists or not, it acts as if the line was never there... either that or its not reading the else line. echo off echo echo (c) Ryan Leach 2010 echo Stockmaster Backup System for exclusive use of Rive...

How can i list all hidden files inside all subdirectories using batch scripting for windows XP?

dir /S /aH doesnt work as it wont delve any deeper inside of unhidden folders. EDIT: turns out it WAS dir /S /aH just there wasnt any hidden or system files or folders within the non hidden files or folders i was testing on. ...

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

getting returned results after running .BAT file

when i run a .BAT file, it displays a message but immediately closes the window how i can i force it to keep the window open so that i can see the message reeturned? ...

how do i run a script using a BAT file

i would like to have a BAT file open a sql server script currently i have this code in the sql file: declare @path varchar(255), @mydb varchar(50) SELECT @mydb = 'timeclockplus' select @path = 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\' + @mydb + '-' + convert(varchar(8),getdate(),112) + '.bak' BACKUP DATABASE @mydb T...

script to move all files from one location to another location

can someone help me with a dos script to move all files from one location to another location ...