cwrsync in windows not being recognised - windows

I am trying to move from a mac environment to a windows one and require rsync.
Found cwrsync # http://www.rsync.net/resources/howto/windows_rsync.html
I have installed the cwrsync program fine, I can call the rsync at cmd but on when in the directory which contains the sync.exe
When in command prompt, if i call rsync when not in the relavent directory it moans and sayS:
"rsync" is not recognised as an internal or external command, operable
program or batch file.
Is there a way to add the rsync.exe to a global list so as rsync is recognised outside of its immediate parent directory?
Thanks,
John

Add the path in the Windows system variables:
- Control Panel -> System -> tab Advanced, button Environment Variables.
- Edit the "Path" system variable and add the full path to the installed rsync:
C:\Program Files\cwRsync\bin or C:\cygwin\bin. or
C:\Program Files (x86)\cwRsync\bin or C:\cygwin\bin.
This way the commands rsync and ssh should run from any directory. Make sure you put in the correct install path to the application else it won't work. See screenshot below:
Environment Variable Setup: Make sure the path you added is under System Variables:
Command: As seen, I am running this directly from root of C: drive

cwRsync distribution contains a batch file example called cwrsync.cmd with correct path settings. You can simply add your rsync command into that file.

Related

'gawk' is not recognized as an internal or external command, operable program or batch file. but other files in the similar path can be run in Cmd

I wan to run a code which should be read in Cmd using gawk. I have installed it in my program file directory. I also have installed another file named Grep.exe in the same directory:
enter image description here
when I try to run codes with these files I can run grep in cmd but I cant run gawk which is in the same directory. see the picture:
enter image description here
I thought the problem is with the path so I tried different things.
1
defining the path in cmd with this command and this link
setx path "%path%;c:\directoryPath"
define path in windows env using this link
Installing in different directory and adding env path
renaming the gawk.exe to ggawk.exe and trying to run
installing in other computrs
none of them work.
I dont know what is the reason that it can read other files in the same directory but not this specific .exe file that I need.

Windows Jenkins How do i use WORKSPACE system parameter when it has spaces?

I'm using Jenkins over windows 7 and i encountered strange behavior.
when im trying to copy files to working directory - represented in Jenkins by the system parameter WORKSPACE, for example like in this code:
cp -a hpdevops-discovery-demoapp-master/. $WORKSPACE/
i get the following:
cp -a hpdevops-discovery-demoapp-master/. 'C:\Program' Files '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/'
cp: target '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/' is not a directory
what's happening: the workspace located here: C:\Program' Files '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/
but, because of the space in the path after the word 'Files' its deviding it into 2 and treating the second part - which is just half of the path, as the target path: '(x86)\Jenkins\workspace\jenkins-AutomationFreeStyle-Pipeline-2/'
i used to work with Jenkins on Linux and never had a problem like this when using the WORKSPACE system parameter.
anyone run into this?
use double quote wrap it like "$WORKSPACE"

Command 'ls' not working in command prompt

Command 'ls' not working in windows
Getting an error while executing 'ls'
'ls' is not recognized as an internal or external command, operable
program or batch file.
Use the command dir to list all the directories and files in Windows; ls is a unix command.
Please follow below steps to fix this
download and install git
https://git-scm.com/downloads.
After git installation is completed,navigate to folder where git is installed. Check in C/Program Files Folder.
Navigate to C:\Program Files\Git\bin
Add the above location (C:\Program Files\Git\bin) in path variable in system environment variables.
Restart cmd and try to run ls and other Linux commands.
It should work now!!`
We don't use ls(List) command in windows.
Instead of using ls command use dir(Directory) command.
This command also displays the total number of files and directories
listed.
NOTE:
We can use ls command in Windows PowerShell. It works in PowerShell, shows the files and directories listed.

How do I get my Windows7 symlink to execute from command line?

I have a couple of batch files I want to use regularly, so I decided I would drop them as symlinks into a binaries folder in my path. The idea being that I would use them like I would any other command, without having to change directories. E.g.
> odbimport -u User -f filename
where odbimport is my symlink to the batch file odbimport.bat.
The process I used to make the symlinks is as follows:
C:\Users\user>mklink C:\utils\odbimport C:\util-files\odbimport.bat
symbolic link created for C:\utils\odbimport <<===>> C:\util-files\odbimport.bat
C:\Users\user>path
Path=C:\....;C:\utils\
C:\Users\user>where odbimport
C:\utils\odbimport
From what I've seen, it looks like I've made the symlink, and the path knows where to find it.
However, after I've made my symlink and attempt to execute, I get:
C:\Users\user> odbimport -u me -f somefile
'odbimport' is not recognized as an internal or external command,
operable program or batch file. "
I've been looking for an answer to this with no success. Everything I find seems to deal more with how to create working symlinks than addressing my issue. The closest thing I found was this. This is essentially my question, except kinda backwards because I don't really want to run the symlinks from Windows Explorer. I have also tried adding .LNK to my PATHEXT variable as in this question.
Add .bat extension to the symlink you create because on Windows .bat extension is necessary to tell the system it's actually an executable batch file. You will still be able to run the file by typing its name only.
mklink C:\utils\odbimport.bat C:\util-files\odbimport.bat
NTSF hardlinks can be used when source and target are on the same volume, the advantage is that such clones may be executed from Windows Explorer unlike symlinks:
mklink /h C:\utils\odbimport.bat C:\util-files\odbimport.bat
fsutil hardlink create C:\utils\odbimport.bat C:\util-files\odbimport.bat

Is it possible to update svn using a windows environmental variable folder?

I have tortoiseSVN installed alongside subversion for windows (not using TortoiseSVN command client tools because of restrictive purposes).
I have a batch file that runs an svn update on certain folders which are used as environmental variables in Windows. Is it possible to svn update a folder using just the folder name?
e.g. from this:
cd C:\foo\johnsmith\testing\
svn update
to something like this?
cd testing\
svn update
I should add that environmental variables are new to me...
With regards to Alrocs comment, the path C:\foo\johnsmith\testing\ is in the system environmental variable "Path".
You can't cd to directory, which is part of your $PATH$. But you can use environment variable, which explicitly contain needed path only (after all - variable is just string)
c:\TEMP>echo "%USERPROFILE%"
"C:\Documents and Settings\Badger"
c:\TEMP>cd "%USERPROFILE%"
C:\Documents and Settings\Badger>
Never assume anything about environment variables that you haven't set via your batch file. Just because it's there today/on your computer doesn't necessarily mean it'll be there tomorrow or on another computer.
But you aren't using an environment variable in your script in the first place.
If you need to update a specific path, be explicit and update that path by specifying the whole path. Don't assume that your testing directory will be an immediate child of the directory you're running the batch file in unless you can control everything else - the whole subdirectory structure, where the batch file executes from, and how it executes.

Resources