Does someone here know how to format the output of windbg command in its script?
Can windbg support regular expression?
Is there some tutorial?
Thanks.
You can run your commands against the command line version of WinDbg, cdb.exe and format the output using perl or python or other script. You do need to tell us what you want to achieve, you can improve the output by turning on DML markup
.dml_start
also you can set this as a preference so it remembers it for every session:
.prefer_dml 1
The above turns on hyperlinks that execute commands but it doesn't change the formatting.
Related
time ./wordcount.sh
The system cannot accept the time entered.
Enter the new time:
How can I fix this?
Thanks
If you are using dos as the tag suggests, then time is the utility to change the system time. You are passing the string ./wordcount.sh as a parameter to time and the program is complaining because it cannot interpret ./wordcount.sh as a valid time.
Try running time /? to see a list of valid parameters that can be passed to the time utility
For more information on how to run bash scripts in windows see:
Is there a way to run Bash scripts on Windows?
I have been messing around with voice commands, but ran into a snag. I am trying to get a terminal command to run but it is not working. The command makes asterisks "snow" fall.
This is what I have so far.
tell application "Terminal"
activate
run script "ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S=["2743".to_i(16)].pack("U*");a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.1}'"
end tell
All I get are errors
Command line scripts executed with the do shell script command. The string escaping can get a bit gnarly, so be careful with that too. Here's a simple example:
do shell script "say \"Today is `php -r \"echo date('l');\"`\""
EDIT:
OK, I just realised your script actually depends on having a Terminal window to run in, so the usual approach of do shell script won't work here.
There are still a lot of unescaped quotation marks in your Applescript, but rather than fixing those, I think it would be easier to put the whole ruby script into a stand-alone file and pass that to Terminal instead.
stars.rb
#!/usr/bin/ruby
C=`stty size`.scan(/\d+/)[1].to_i;
S=["2743".to_i(16)].pack("U*");
a={};
puts "\033[2J";
loop {
a[rand(C)]=0;
a.each {
|x,o|;
a[x]+=1;
print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"
};
$stdout.flush;
sleep 0.1
}
AppleScript
tell application "Terminal"
activate
do script "~/stars.rb"
end tell
An easy way to escape a shell command for AppleScript is to save the command in a text file. Run the script below and copy the Result.
set myText to read (choose file) as «class utf8»
I have a series of perl scripts that I want to run one after another on a unix system. What type of file would this be / could I reference it as in documentation? BASH, BATCH, Shell Script File?
Any help would be appreciated.
Simply put the commands you would use to run them manually in a file (say, perlScripts.sh):
#!/bin/sh
perl script1.pl
perl script2.pl
perl script3.pl
Then from the command line:
$ sh perlScripts.sh
Consider using Perl itself to run all of the scripts. If the scripts don't take command line arguments, you can simply use:
do 'script1.pl';
do 'script2.pl';
etc.
do 'file_name' basically copies the file's code into the current script and executes it. It gives each file its own scope, however, so variables won't clash.
This approach is more efficient, because it starts only one instance of the Perl interpreter. It will also avoid repeated loading of modules.
If you do need to pass arguments or capture the output, you can still do it in a Perl file with backquotes or system:
my $output = `script3.pl file1.txt`; #If the output is needed.
system("script3.pl","file1.txt"); #If the output is not needed.
This is similar to using a shell script. However, it is cross-platform compatible. It means your scripts only rely on Perl being present, and no other external programs. And it allows you to easily add functionality to the calling script.
I have a powershell script that takes an input parameter (int). the script then updates the status of the service based on this input parameter.
I have been working on this task using the powergui editor .
Screencap from powergui window
Whenever I try to run the script from the command line of powershell file, there is nothing that's being reported by powershell . No output .. nothing.
Screencap from powershell window
Can you please let me know what might be happening here.
Thanks
Maybe you called the programm services.exe from the command line. You might try to rename your function.
You might know the following allready, but did you parse your powershell script before you called your function? This is nessesary to include your function into the shell. You have to invoke D:\ps>.\myScript.ps before you can use the function.
I have a lot of PowerShell script. One main, that calls other, child ones. Those PS scripts in their turn call windows CMD scripts, bash scripts and console applications. All these scripts and applications write messages to console. PowerShell scripts, for example, are using Write-Host scriptlet for this purpose.
Question: how can I easely redirect (send) all this console output to some file, while not deafening (canceling) this console output? I want to be able to see whats going on from console output and also have history of messages in log file.
Thanks.
You can use the tee equivalent of PowerShell : Tee-Object
PS: serverfault.com and/or superuser.com are more suitable for a question like this.
You can try Start-Transcript and Stop-Transcript. It has a couple of limitations like not capturing native exe output. It is also global to PowerShell session.
I've found script for grabbing console output: http://gallery.technet.microsoft.com/scriptcenter/e8fbffde-7d95-42d9-81de-5eb3d9c089e0. Script returns HTML to preserve colors.
The only big downside - you must call it at the end of your script to capture all console output it have made.
You'd probably need to write a custom host to do this. It's not a terribly hard thing to do, but it's does require some managed code.