scripting

iexpress extract files then run script refering extracted file.

I was trying to deploy my project with IExpress. I have the following scenario. I want to extract some files to a location preferably c:\program files\. Then after it copies all the files i want it to run a .cmd file (which is a script). the script is also added in the project itself and it would refer to a file which is copied by IExpre...

How to remove the password from a log file in windows?

I have a deployment script (.bat), part of which requires calling other programs and sending a password on the command line. I log the output of the deployment script to a file. The problem is that the password gets logged as well. I need a way of sanitizing this log file. One way to do this is to not echo the line which contains the p...

Running a SQL install script with SMO. Alternative solutions needed.

Hi folks, I've got a web application that uses Microsoft Sql Management Objects (SMO) dll's. I'm wondering how I go about redistributing the libraries for a remote machine. As I understand it, these come with SQL server or Sql express - which isn't on the remote (shared) webserver. Asking the host to install them, is probably out of t...

How can I extract a full path from the PATH environment variable?

I want to extract a full path from the PATH environment variable with native cmd tools. Consider the following PATH content: C:\Program Files\Windows Resource Kits\Tools\;C:\Perl\site\bin;C:\Perl\bin;C:\WI NDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files\Microsoft SQ L Server\90\Tools\binn\;C:\WINDOWS\system32\...

How do I extend this batch command?

I came across this piece of batch code. It should find the path to every single .exe file if you enter it. @Set Which=%~$PATH:1 @if "%Which%"=="" ( echo %1 not found in path ) else ( echo %Which% ) For instance, if you save this code in the file which.bat and then go to its directory in DOS, you can write which notepad.exe The resu...

Bash: How to do a variable expansion within an arithmetic expression?

While attempting to write a simple bash script to help with my deployment process, I ran in to a confusing error: #!/bin/bash WEEKDAY=$(date +'%u') echo $WEEKDAY DAYS_TO_WEDNESDAY=$((3-$WEEKDAY)) echo $DAYS_TO_WEDNESDAY Results in: 1 ")syntax error: invalid arithmetic operator (error token is " The strangest part of it is that I c...

Run CMD equivalent in OSX?

I'm using this code to make my Java program open a (visible) CMD window: try { String line; Process p = Runtime.getRuntime().exec("cmd /C start \"Render\" \"" + myPath + "\\punchRender.cmd\""); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream())); ...

Write an executable .sh file with Java for OSX

So I am trying to write an .sh file that will be executable, this is how I'm currently writing it: Writer output = null; try { output = new BufferedWriter(new FileWriter(file2)); output.write(shellScriptContent); output.close(); } catch (IOException ex) { Logger.getLogger(PunchGUI.class.getName()).log(Level.SEVERE, null, ex); }...

batch file equivalent for this code

HI i want to implement this C code in batch file int i; scanf("%d", &i); for(int j = 0;j<i;j++) { scanf("%d",&j); printf("%d",j); } I would run the c program using > redirection in DOS so that the printed output comes to me in a file. I want to do the same thing in my batch file where i could write something like echo %variable...

Internet Explorer problem - runtime error

when i am going through my project in IE only its showing errors A runtime error has occurred Do you wish to debug? Line 768 Error:Expected')' Is this is regarding any script error ...

Batch File input validation - Make sure user entered an integer

I'm experimenting with a DOS batch file to perform a simple operation which requires the user to enter a non-negative integer. I'm using simple batch-file techniques to get user input: @ECHO OFF SET /P UserInput=Please Enter a Number: The user can enter any text they want here, so I would like to add some routine to make sure what the...

bash stacktrace

I need something like a stacktrace in bash, is that possible? A script is misbehaving. I need to know who calls that script, and who calls the calling script, and so on, only by modifying the misbehaving script. What do you say? ...

Is there a way to automate Microsoft Learning Gateway setup?

Hi Guys, after attending a mind numbing three days workshop on MLG, what i noticed is that 90% of the time is wasted on just configuring the setup for each components for MLG, namely the sharepoint, isa, exhchange, active directory etc. as a developer and a big fan of automation, i see all this tedious task as brain cell destroying acti...

shell script to reset Evolution passwords

I posted the following question to the Ubuntu forum and no success yet. I realize this is less of a programming issue and more of an Evolution/Ubuntu issue, but given that I want to automate the solution it seems not inappropriate to post it here... Here is the problem. I changed my Google account password recently and now Evolution (U...

Server Side Javascript: Why?

Is the use of server side javascript prevalent? Why would one use it as opposed the any other server side scripting? Is there a specific use case(s) that makes it better than other server side languages? Also, confused on how to get started experimenting with it, I'm on freeBSD, what would I need installed in order to run server side ja...

Bash script to find a file in directory tree and append it to another file

The title is rather more simplified than the functionality I am trying to express in a script. I have a one-level deep directory tree (much bigger than example) which contain various content, although only two particular files are of interest to me. A file called 'current' and another called 'revisions' - foo | |-> current - ba...

PowerShell "Advance" parsing to calculate components installation time based on log file

Hi, i have an application that create a log file of the following format: 2009-03-27 15:30:50 Start 2009-03-27 15:30:51 Starting Component 1 Installation 2009-03-27 15:30:52 blah 2009-03-27 15:30:53 blah 2009-03-27 15:30:54 blah 2009-03-27 15:30:55 ~~~ Finished Component 1 Installation ~~~ 2009-03-27 15:30:56 Starting Component 2 Insta...

whats your favourite entry in .dbxrc ?

I have started to customize my .dbxrc file to save some time while debugging. What is yours favourite entry in .dbxrc file ? here is mine: export PS1='[ (dbx) Working Hard @ $(date +%H:%M:%S) ]' alias si="stop in" alias attr=attribute alias bfth=stop alias blth=stop alias c=cont alias cv=condition alias d=delete alias e=edit alias h=h...

How do I write a bash script to restart a process if it dies?

I have a python script that'll be checking a queue and performing an action on each item: # checkqueue.py while True: check_queue() do_something() How do I write a bash script that will check if it's running, and if not, start it. Roughly the following pseudo code (or maybe it should do something like ps | grep?): # keepalivescr...

Refreshing the Windows XP font cache via a script

Does anyone know how to force windows XP to rebuild the list of installed fonts without needing a reboot. They seem to have been installed correctly since everything works as expected after a reboot but I would like to avoid that reboot. ...