calling mkdir in ctest on Windows - windows

I would like to create a directory in ctest/add_test command to save test data by using this command in CTestTestfile.cmake:
add_test(test-name "cmd" "/c" "mkdir -p C:/Users/user/project/test_dir" "do_something_else")
However I kept getting error
The syntax of the command is incorrect.
Even the command
add_test(test-name "cmd" "/c" "mkdir -p C:\\Users\\user\\project\\test_dir")
doesn't work. Any hint?

Related

Execute command inside a bash script with space inside parameter

I'm having the following issue. When I execute this command sfdx profile:field:add -n "Account.Test" -m re -p "Test" from a Bash script, it's all fine.
However, when I try to execute the following:
sfdx profile:field:add -n "Account.Test" -m re -p "Test Test"
I get this error: 'C:\Program' is not recognized as an internal or external command
When I run the same command in the terminal, it works fine. It's just when I put it inside a bash script that this error happens.
Currently running this on Windows 10.
I'm 100% sure it's the space in that last parameter, I am just not sure how to get around it. Can anyone help?

cannot run "mv some_file.txt ~/myproject/ " command in the cmd ipython

I have installed Anaconda in the Windows 10, I am able to run the IPython in cmd with some Linux commands like 'ls' and 'pwd' but when I try to run the 'mv' command
"
mv some_file.txt ~/myproject/
it gives the error :
File "<ipython-input-28-304da5ec8c93>", line 1.
Can someone please tell me what would be the correct format to run this shell code in
command prompt IPython.
to_run: mv ../myproject.txt ./
In [45]: !move myproject.txt C:\Users\user_name
1 file(s) moved.
In [46]: pwd
Out[46]: 'C:\Users\user_name\folder_name'
In [48]: cd ..
C:\Users\use_name
******* to_run: cp myproject.txt myproject\
In [49]: !copy myproject.txt C:\Users\user_name\myproject
1 file(s) copied.
Thanks #Ahmed Yehia you lead me to the answer
You get an error because mv is not a supported magic command on Windows. Going through the docs I couldn't find an equivalent magic command but this might help you:
!move some_file.txt C:\Users\Some_User\myproject\

Linux to windows execute commands remotely

I have to zip files on a remote windows machine.
So I first ssh to the windows machine
ssh my_user#my_host "cd /d D:\MyFolder"
And the above command works.
However if I try to run any command after that it fails.
So if I do something like
ssh my_user#my_host "cd /d D:\MyFolder; dir"
The system cannot find the path specified.
You can try something like:
ssh my_user#my_host <<EOF
cd /d D:\MyFolder
dir
EOF
The second EOF should be alone on the line and start from the begin

Chef cookbook recipe - executing windows batch command

I need help in writing chef recipes. I have some jobs in Jenkins and they are done by Execute Windows batch command. I have to rewrite this commands to chef recipe but I can't become familiar with writing these recipes... I need some example of this kind of "rewriting".
For instance, this command:
D: && cd D:\[some path] && pc.exe "\\[some folder]" -u "admin" -p [pass] cmd /c "c: && cd C:\some folders]\ && install.bat"
need to be rewrite to chef reciepe.
I can show other commands if it is needed.
I would by grateful to all kind of help
Something along the line:
execute "install" do
command %Q{pc.exe "\\[some folder]" -u "admin" -p [pass] cmd /c "cd /D C:\some folders] && install.bat"}
cwd "d:\[some path]"
end
should do.
Without any insight on what does this command at all, it's hard to give a better advice, as for the placeholders, using attributes should be the way to go, but it's hard to tell without an entry point.
More details in the documentation

Error with relative paths when running cygwin bash file from cmd

I have cygwin bash.sh file that contains the following:
bash.sh:
cd "data processing"
"data processing" at the same directory of bash.sh
I'm trying to run this bash file from cmd not cygwin for some reason.
First, I've updated the path environment variable with cygwin bin directory.
cmd command:
cd "<the-bash-file-directory>"
bash --login -c "bash '<the-bash-file-directory>\\bash.sh'"
then it gives me that error:
error
cd: data processing: No such file or directory
I'm a beginner in using cmd and cygwin and really stuck lots of the time at running things from each other and conflating paths!
Because bash.sh isn't being run from <the-bash-file-directory>. It's being run from your home directory. The --login switch is causing that to happen. You need to do something like this:
bash --login -c "cd <the-bash-file-directory> && ./bash.sh"
or get rid of the --login switch if you can:
cd "<the-bash-file-directory>"
bash -c "./bash.sh"

Resources