i want to map and checkIn a local folder which contains files into TFS using power shell scripting.
Tag: shell,powershell,tfs,tf
i want to map and checkIn a local folder which contains files into TFS using power shell scripting.
The sequence would be:
tf workspace /new
(Create a new workspace)
tf workfold /map
andtf workfold /cloak
(Map server folders to local folders)
tf get
(optional to get the contents of the server folder)
tf add
(Add the files/folders to the staging area)
tf checkin
(check in the changes)
tf workspace /delete
(optional to remove the (temporary) workspace)
If you need to merge/resolve conflicts, you can use tf resolve
.
javascript,node.js,shell,require,node-modules
As per issue #5431, looks like the Node.JS REPL doesn't find globally-installed modules and this is expected behaviour. In the article linked from that issue, it reads: If you’re installing something that you want to use in your program, using require('whatever'), then install it locally, at the root of your...
You never output $DRIVE anywhere, and the expression for $DRIVE shouldn't be in a scriptblock in the first place. The computer name is repeated several times, because you get the SystemName property for each logical disk object. Also, $OS gets the OS name for the local computer, not the remote...
powershell,batch-file,escaping,powershell-v2.0,comma
".\pacli DELETEUSER DESTUSER='"[email protected]`,com"' sessionid=333" You have double quotes in single quotes in double quotes, so the inner double quotes will terminate the string, so this will be parsed as three values: ".\pacli DELETEUSER DESTUSER='" [email protected]`,com "' sessionid=333" The answer is to escape, with a back tick (`), the inner...
Try this to create a string variable n, with no leading whitespace (thanks @011c): n="10.0.0.135.527" wget http://infamvn:8081/nexus/content/groups/LDM_REPO_LIN64/com/infa/com.infa.products.ldm.ingestion.server.scala/"$n"-SNAPSHOT/com.infa.products.ldm.ingestion.server.scala-"$n"-20150622.210643-1-sources.jar ...
Not the best regex but this would be a good start. You aren't specific about what the line looks like so I will assume that it is on its own line with variable whitespace and or text. Get-ChildItem C:\temp\*.asp | ForEach-Object{ $file = $_.FullName (Get-Content $file) -replace '(.*UserRights\s*)"(.*?)"(.*)','$1("$2")$3' | Set-Content...
You can find like this. File file = new File("data/pattern.txt"); Pattern pat = Pattern.compile("subclass \"Pool1\" 11:22:33:44:55:66 \\{\\s*dynamic;\\s*\\}"); String content = Files.lines(file.toPath()).collect(Collectors.joining("\n")); Matcher m = pat.matcher(content); while (m.find()) { System.out.printf("found at %d-%d%n", m.start(), m.end()); } ...
You use Get-ADUser and filter on user principal names that end with @sec213.com: $domain = ([adsi]'').distinguishedName $ou = "OU=users,OU=SEC213,OU=Uofguelph,$domain" $suffix = '@sec213.com' Get-ADUser -Filter "userPrincipalName -like '*$suffix'" -SearchBase $ou ...
regex,linux,shell,unix,replace
You can do it using awk as: awk '/\[x/{f=1} {if(f)printf "%s",$0; else print $0;} /y\]/{print ""; f=0}' Output: [x data1 data2 data3 data4 y] [a data5 data 6 data7 data 8 b> [x data y] You can also simplify to: awk '/\[x/,/y\]/{ORS=""; if(/y\]/) ORS="\n";}{print}' Output: [x data1 data2 data3 data4...
linux,shell,command-line,awk,sed
Almost same as the other answer, but printing 0 instead of blank. AMD$ awk -F, 'NR>1{a[$2]+=$3;b[$2]++} END{for(i in a)print i, a[i], b[i]}' File pear 1 1 apple 2 3 orange 0 1 peach 0 1 Taking , as field seperator. For all lines except the first, update array a. i.e...
.net,powershell,f#,system.reactive,f#-async
I ended up creating an EventSink that has a queue of callbacks that are executed on the main PowerShell thread via Drain(). I put the main computation on another thread. The pull request has the full code and more details. ...
The 'grep' command uses a regular expression to match text. Use a '^' before the expression, to match from the start of the line. So, you can change the line name=$(echo $hello | cut -d' ' -f9 | grep $1) to name=$(echo $hello | cut -d' ' -f9 | grep...
What is the whole "gps" part of the script for? The two (gps excel -ErrorAction SilentlyContinue).count lines at the start and end of the script count the number of Excel executables running. gps is the shorthand alias for get-process. You can find out more by doing help gps which...
sql-server,sql-server-2008,powershell
OK so if the SQL query does not have results then NULL is returned and, in essence, nothing is added to the $dbResults array. Instead lets append the results to a custom object. I don't know what PowerShell version you have so I needed to do something that I know...
. is the dot sourcing operator, which runs a script in the current scope rather than a new scope like call operator (i.e. &). That second segment invokes a script block and in that script block defines an advanced function. The advanced function iterates each item in the pipeline and...
You can use it with ssh and heredoc like this: ssh -t -t [email protected]<<'EOF' sed 's~out_prefix=orderid ^2\\\\d\\+ updatemtnotif/~out_prefix=orderid ^2\\\\d\\+ updatemtnotif_fr/~' ~/path/to/file exit EOF PS: It is important to quote the 'EOF' as shown....
Shai Raiten's Blog is great for learning the TFS API. For getting file history - read this post: http://blogs.microsoft.co.il/shair/2014/09/10/tfs-api-part-55-source-control-get-history/...
To read the text after the # characters you must read the file content up to the # characters first. Also, in PowerShell you normally read files either line by line (via Get-Content) or completely (via Get-Content -Raw). You can discard thos parts of the read content that don't interest...
windows,powershell,command-line,exif,exiftool
You'll probably have to go to the command line rather than rely upon drag and drop as this command relies upon ExifTool's advance formatting. Exiftool "-SerialNumber<001-001-0001-${filesequence;$_=sprintf('%04d', $_+1 )}" <FILE/DIR> If you want to be more general purpose and to use the original serial number in the file, you could use...
Get-ChildItem produces a list of objects. Use a pipeline for processing that list: Get-ChildItem '\\kiewitplaza\vdi\Appsense_profiles' | Where-Object { $_.Name -like '*.old' } | Remove-Item ...
I would simply start the tail in background and the python process in foreground. When the python process finishes you can kill the tail, like this: #!/bin/bash touch /tmp/out # Make sure that the file exists tail -f /tmp/out & pid=$! python test.py kill "$pid" ...
From what I understand I would recommend you look in to Applescript as this will allow you to have a GUI Interface as well as executing 'SHELL' commands. First of all I would open 'Script Editor' program that comes preinstalled on Mac's This is an example script which asks for...
I'd rewrite that as: #!/bin/bash while read -ra hello; do name=${hello[8]} if [[ $name == "$1"* ]]; then log=${hello[2]} echo "$log $name" fi done | column -t read -ra splits the input line and stores the words in the "hello" array. [[ $name == "$1"* ]] is a built-in way...
html,powershell,powershell-v2.0
You should format your HTML result with a different style if there's a condition. To do that, you declare a variable for data style that should be equal to $normalDataStyle if your condition is false, and a special style if it's true. $redDataStyle='style = "border: 1px solid black; background: #c00000;...
You're missing a set of parentheses (()) at the end of $XmlWriter.WriteEndElement: $xmlWriter.WriteStartElement("Disk$count") # Add tag for each drive $xmlWriter.WriteElementString("DriveLetter","$DriveLetter") # Write Drive Letter to XML $xmlWriter.WriteElementString("DriveSize","$DriveSize") # Write Drive Size to XML $xmlWriter.WriteElementString("DriveFreeSpace","$DriveFreeSpace") # Write Drive Free Space to XML $xmlWriter.WriteEndElement() # <-- Closing Drive Tag - don't forget...
windows,git,powershell,github,go
The root cause has been found: Because my computer use a web proxy, so I need to set proxy in environment variable: C:\Users\xiaona>set https_proxy=https://web-proxy.corp.hp.com:8080/ C:\Users\xiaona>set http_proxy=https://web-proxy.corp.hp.com:8080/ C:\Users\xiaona>go get -v gopkg.in/fatih/pool.v2 Fetching https://gopkg.in/fatih/pool.v2?go-get=1 Parsing meta tags from https://gopkg.in/fatih/pool.v2?go-get=1 (status code 200) get "gopkg.in/fatih/pool.v2": found meta tag main.metaImport{Prefix:"gopkg.in/fa tih/pool.v2", VCS:"git",...
Using sqlite3 from bash on OS X seems fairly straightforward (I'm no expert at this, by the way). You will need to find out which table you need. You can do this with an interactive session. I'll show you with the database you suggested: /Users/fredbloggs> sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db SQLite version...
I think this issue is a matter of stepping back and taking a look at the bigger picture. You're focused on the value or a property, and how to get that property name that you aren't taking into consideration that the property is just a part of a larger object,...
Assuming that your document is well-formed, i.e. <b> opening tags always match with a </b> closing tag, then this may be what you need: sed '[email protected]<[/]\?b>@\n&\[email protected]' path/to/input.txt | awk 'BEGIN {buf=""} /<b>/ {Y=1; buf=""} /<\/b>/ {Y=0; print buf"</b>"} Y {buf = buf$0} ' | tr -s ' ' Output: <b>data1</b>...
anubhava's solution is excellent if, as they do in your example, the extensions sort into the right order. For the more general case, where sorting cannot be relied upon, we can specify the argument order explicitly: for f in *.ext1 do program "$f" "${f%.ext1}.ext2" done This will work even if...
You can't get CPU for some processes because of insufficient rights. You get null value then. To output "Nothing" you have to compare the cpu value with $null, something like this: [email protected]{Expression={$_.ProcessName};Label="ProcessName";Width=40},@{Expression={$cpu=$_.CPU;if($cpu -eq $null){"Nothing";} else {$cpu;}};Label="CPU";Width=20} $ServiceTable = @{Expression={$_.Name};Label="Name";Width=40},@{Expression={$_.Status};Label="Status";Width=10} Get-Process | Sort-Object CPU -Descending | Select-Object ProcessName, CPU | format-table...
The most common issue when handling variables containing paths of directories and files is the presence of special characters such as spaces. To handle those correctly, you should always quote the variables, using double quotes. Better code would therefor be: sudo sh "$path/join.sh" sudo sh "$path/join2.sh" It is also advised...
bash,shell,curl,command-line,pipe
Try this: curl --silent "www.site.com" > file.txt ...
#!/bin/bash string=$1 if [[ $(type "$string" 2>&1) == "$string is a shell"* ]]; then echo "Keyword $string is reserved by shell" fi ...
You should run the update command from nuget.exe. One of the parameters of the update command is FileConflictAction, which tells what action to take when asked to overwrite or ignore existing files referenced by the project: overwrite, Ignore, None. You might have to wrap everything in a powershell script, possibly...
How about not performing a remove, but just sort on tastecode descending and taking just one first result? $DuplicateMembers = $Fruits | Group-Object Name $DuplicateMembers | ForEach-Object { $Outcome = $_.Group | Sort-Object TasteCode -descending | Select -First 1 $Outcome } This way you should not bother to remove anything...
Executable files may be scripts (in which case you can read the text), or binaries (which are ELF formatted machine code). Your shell script is a script; git is an ELF binary. You can use the file command to see more detail. For example, on my nearest Linux system: $...
$configs=gwmi win32_networkadapterconfiguration | where {$_.ipaddress -ne $null -and $_.defaultipgateway -eq $null} if ($configs -ne $null) { $yourtargetIP= $configs[0].IPAddress[0] } # $yourtargetIP will have the IP address to make the gateway from In fact, should you have more than one IPv4 address on your network card, $configs[0].IPAddress will have them all,...
I would store the output of find, and if non-empty, echo the line break: found=$(find . -name "${myarray[i]}") if [[ -n $found ]]; then { echo "$found"; echo "<br>"; } >> "$tmp" fi ...
Using the redirection operator to write the checksums to an output file causes the file to be created with the default encoding (Unicode). md5sum expects an ASCII file. Use Set-Content (or Out-File) to save the file with ASCII encoding: md5sum jira_defect.txt | Set-Content result.md5 -Encoding ASCII You can also work...
Something like this with grep: grep -vxf lines.txt data.txt > no_dupplicate_lines.txt Sample: AMD$ cat lines.txt Line2 Line4 AMD$ cat data.txt Line1 Line2 Line3 Line4 Line5 AMD$ grep -vxf lines.txt data.txt Line1 Line3 Line5 Print the lines that are not matching (-v) the exact lines (-x) from the file lines.txt (-f...
Use upgrade_oh_my_zsh upgrade to the latest version. This issue fix here...
Try this: find . -mmin +35 -or -mmin -25 find supports several logical operators (-and, -or, -not). See the OPERATORS section of the man pages for more details. ==================== EDIT: In response to the question about processing the two matches differently, I do not know of a way to do...
If the text infront and including "Resources" is redundant then using a simple regex we can replacing it before it is output from your function. From $path to $path -replace "^.*?Resources/" So that would replace the similar line inside your function ( Where you return the property). We take everything...
With GNU grep: grep -oP 'aaa&\K.*' file Output: 123 456 \K: ignore everything before pattern matching and ignore pattern itself From man grep: -o, --only-matching Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line. -P, --perl-regexp Interpret PATTERN as a...
Your second bit of code hurts my brain, but I think what you want is to output where multiple accounts use the same email address, grouped by email address. So, let's start with getting duplicates. Your first bit of code is kind of functional, but it really collects way more...
To add a simple loop, you can use your existing AutoImportFlatFiles function like this: $Folder= $(read-host "Folder Location ('C:\Test\' okay)") foreach ($file in (get-childitem $Folder)) { $location = split-path $file.FullName -Parent $filename = (split-path $file.FullName -Leaf).split(".")[0] $extension = (split-path $file.FullName -Leaf).split(".")[1] AutoImportFlatFiles -location $location -file $filename -extension $extension -server "WIN123"...
linux,shell,sed,grep,pattern-matching
The -v option to grep inverts the search, reporting only the lines that don't match the pattern. Since you know how to use grep to find the lines to be deleted, using grep -v and the same pattern will give you all the lines to be kept. You can write...
Also if you want it to look more nice and readable you can do something like this that will spit it out in a table: $body += "<body><table width=""560"" border=""1""><tr>" $bodyArray[0] | ForEach-Object { foreach ($property in $_.PSObject.Properties){$body += "<td>$($property.name)</td>"} } $body += "</tr><tr>" $bodyArray | ForEach-Object { foreach ($property...