winbatch

Windows clipboard CRLF/LF passing wrong for one user

We have a pair of applications. One is written in C# and uses something like: string s = "alpha\r\nbeta\r\ngamma\r\ndelta"; // Actually there's wrapper code here to make sure this works. System.Windows.Forms.Clipboard.SetDataObject(s, true); To put a list of items onto the clipboard. Another application (in WinBatch) then picks u...

Issue with nested calls with psexec (access denied)

Hello First of all, sorry for my poor english. I would try to explain my problem. I am using psexec within a script to restart a cluster as follows: script1 in node1: perform a lot of tasks (shutdown services, check status, etc..) in the node1 and after completing all task launch with psexec the script2 in node2 (psexec-d \ \ node2...

How do I pass formated (\n \t) text to a java command line

I need to pass a formatted string in a command line so that the input text is presented formatted in a JFrame: Hello The sun is shinning! How do I put a '\n' in a Windows batch file? java -cp . Test "Hello\nThe sun is shinning!" I cannot change the program, it is expecting a string as a command line parameter to be shown in a TextB...

How can I reliably validate existence of a directory via WinXP batch script?

Howdy, I'm writing a batch script that will run on a Windows XP machine. This script needs to be able to reliably validate that a directory, passed as a command-line parameter, does in fact exist. Assuming my script is named script.bat, it needs to support the following as legal command-line parameters: C:\> script.bat C: C:\> script.b...

How do I set the encoding statement in the XML declaration when performing an XSL transformation using a COM Msxml2.XSLTemplate?

I wrote a simple package installer in WinBatch that needs to update an XML file with information about the package contents. My first stab at it involved loading the file with Msxml2.DOMDocument, adding nodes and data as required, then saving the data back to disk. This worked well enough, except that it would not create tab and CR/LF wh...

Best way to incorporate legacy data

I am working on a price list management program for my business in C# (Prototype is in Win Forms but am thinking of using WPF for the final ap as a MVVM learning exercise). Our EMS system is based on a COBOL back end and will remain that way for at least 3 years so I cannot really access it's data directly. I want to pull data from them...

Batch : script deleting itself

I have a .bat script launching a java program. The java program deletes the folder where the .bat sits. I have no way to touch the java program. I only can modify the .bat file. The problem is that the .bat file, once deleted, stops its execution right away without finishing. But there are some cleanup tasks to be done after the java ...

How to remove the hard brackets from a variable in a windows batch script?

I am a windows batch dunce. I have a variable storing some text surrounded by hard brackets like: [glcikLhvxq1BwPBZN0EGMQ==] But I need to pass it as an argument like: glcikLhvxq1BwPBZN0EGMQ== How can I strip these hard brackets from the beginning and end in my windows batch file? ...

extract few characters from a file by using batch script

Hi All, I want a batch script which will extract the first 30 characters from a file. Requirement: there is one file called test.txt and it's content is \765514e2aad02ca658cc56cdb7884947 *E:\test1 now I need a script which extract only \765514e2aad02ca658cc56cdb7884947 from the above file Thx in advance ...

Windows batch assign output of a program to a variable

I need to assign the output of a program to a variable using a MS batch file. So in GNU Bash shell I would use VAR=$(application arg0 arg1). I need a similar behavior in Windows using a batch file. Something like set VAR=application arg0 arg1. Thanks! ...

How to NOT wait for a process to complete in batch script?

I a batch script that calls a process and it waits for the process to complete before going to the next line by default. Is there a way (or a switch) for it NOT to wait and just run the process and continue? I am using Windows 2008. ...

Windows batch file to delete .svn files and folders

Hi,in order to delete all ".svn" files/folders/subfolders in "myfolder" I use this simple line in a batch file: FOR /R myfolder %%X IN (.svn) DO (RD /S /Q "%%X") This works, but if there are no ".svn" files/folders the batch file shows a warning saying: "The system cannot find the file specified." This warning is very noisy so I was w...

Prevent command "del /s" from entering a folder

I need to recursively remove unnecessary files from a svn repository and i have the following batch file to do this: @echo on del /s ~*.* del /s *.~* del /s Thumbs.db However, this is also deleting the entries under the .svn/ subfolders. Is there any way to prevent this commands from being executed under the .svn/ folders so that it d...

variable in variable in batch and delayed expansion

Hi, I'm trying to use variable in variable in conjunction with delayed expansion but still no luck. SETLOCAL EnableDelayedExpansion SET ERROR_COMMAND=exit /B ^!ERRORLEVEL^! This is my last try. I want to setup an ERROR_COMMAND to be called when one of the steps in batch file crashes. The command is supposed to be: IF ERRORLEVEL 1 !ER...

Batch For /F Syntax with %time%

How do I accomplish this: for /f "tokens=1-4 delims=: " %%a in ('%time%') do set XTime=%%a.%%b.%%c.%%d I'm trying to get the contents of %time% e.g., 16:25:15.65 into 16.25.15.65. Running the command above gives me: The filename, directory name, or volume label syntax is incorrect. (If it matters I'm on Windows XP) ...

How to remove CR from CRLF

Possible Duplicate: Whats the best way of doing dos2unix on a 500k line file, in Windows? i have windows format*.cpp files now i want to convert it into Linux format(File with LF only) Is it possible to write a batch file. Please provide some valuable help Thanks ...

Loop issue displaying data in TXT file with BATCH programming

HI, I want to display datas in text file. Here i have Listfile.txt and want to display each line using batch file. How to do this with looping. Below is my code for /f "tokens=* delims= " %%a in (Listfile.txt) do ( set /a N+=1 set v!N!=%%a ) set hostname=!v1! echo %hostname% pause Data in Listfile.txt: 4mLinuxMachine.cpp Shutd...

Unable to use relog to extract processor counters

When I run the following command on Windows 7 machine, relog *.blg -f csv -c "\Processor(*)\% Processor Time" -o CPUCounters.csv it returns Error: No data to return the same wildcard work when extracting PhysicalDisk counters any ideas/ suggestions? ...

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

How to create .bat file to run c# code?

What I need is that: I have a c# code and I want to build it in order to create a .bat file on desktop. So when I run this .bat file from desktop, it should execute the c# code. Is there a way to change the settings or properties of c# project before compiling in order to create a .bat file that should run this c# code? ...