Xcopy: invalid number of parameters or file not found error - xcopy

From inside a .bat file, I m issuing this command
xcopy\s Folder1\folder2\folder3\blah-blah Folder1\temp\folder2\folder3
But I get the error:
The system cannot find the path specified.
I tried copying the same line to command line and tried it:
Then, I get the error, xcopys command not found.
If I try to use xcopy instead of xcopy/s, I get error:
File not found - Folder1folder2folder3blah-blah
If I use xcopy command with backward slash on command line: Invalid number of parameters.
I tried enclosing paths in quotes, but it does not help.
My file names don't have spaces in them but they do have -
I have checked the path of source and destination and they exist
Any help will be appreciated.
Thanks

I guess you're running under windows, so you have to use forward slashes for arguments.
xcopy/s is something very different from xcopy\s. The later searches for an application called s in a subfolder called xcopy. To further avoid confusion, separate the program from its argument(s) with spaces.

Related

Calling Flash Magic from command line with parentheses in path

I need to program my microcontroller via Flash Magic command line.
Command is:
COM(6, 115200)
DEVICE(LPC2368, 4.000000, 0)
HARDWARE(BOOTEXEC, 50, 100)
ERASE(DEVICE, PROTECTISP)
HEXFILE(C:\Program Files (x86)\myfile.hex, NOCHECKSUMS, NOFILL, PROTECTISP).
When using any different path without parentheses, this goes perfectly well.
But when "(x86)" is involved I get an error:
ERROR: Invalid parameters for HEXFILE directive: HEXFILE(C:\Program
Files
(x86)
I tried surrounding the path with quotes or double quotes but I get the same error.
Does anyone know how to correctly pass a path argument with parentheses?
For those having the same problem:
there is no workaround with versions <12 of Flash Magic, but fortunately version 12 resolves this issue.

Folder name with space issue

How do I handle a folder name containing spaces in Perl? For example C:\Sample Picture\Data.
I wrote this
use File::Glob ':glob';
$indir = "C:\\Sample Picture\\Data\\";
#flist = bsd_glob( $indir.'*');
This is throwing an error
The syntax of the command is incorrect.
The error message The syntax of the command is incorrect comes from the Windows command line, not from Perl
The issue is not to do with File::Glob, but with whatever you are doing with the contents of #flist. It's my guess that you're using backticks or system to rename one or more of the files or directories. This will fail if you use paths that contain spaces without enclosing the complete path in double quotes
If you need any more help then you must show the relevant part of your code

How to change the directory to program files using Powershell?

I would like to open a C:\Program Files\R\R-3.2.0\bin\Rscript.exe. For that I am trying to change the directory. I figured that the error is in opening Program files. Following is the code
cd Program Files\R\R-3.2.0\bin
Error: A positional parameter cannot be found that accepts argument Files
Unlike command.com/cmd.exe, PowerShell follows much more consistent rules and in the failing case Program and Files\R..bin are parsed as two separate arguments, where the second is invalid in context (as cd only accepts a single non-named argument).
To fix this use quotes, eg.
cd "C:\Program Files"
With the quotes it is parsed as a string value which is supplied as a single argument (the string itself does not include the quotes, again unlike cmd.exe rules).
FWIW, cd is an alias for Set-Location. Run get-help cd for the details on how it can be used - include which optional (and named) parameters it does support.
You need to put the path in quotes if it contains a space:
cd 'C:\Program Files\R\R-3.2.0\bin'
Either single or double quotes will work.

Passing parameter from TFS Build Process Template to Powershell Script, with two consecutive spaces

So I have created a build process template in TFS 2012 that has to pass a path name to a Powershell Script, which in turn concatenates files in the specified directory.
Some of these path names might have two consecutive spaces, which has turned out to be a problem.
When I invoke the powershell script, I enclose the path name in single quotes, and the command that is executed looks something like this.
powershell C:\psScript.ps1 'C:\tmp\two spaces\myFolder'.
However, when I try and open the directory in Powershell, I get the following error:
Get-Item : Cannot find path 'C:\tmp\two spaces\myFolder'
because it does not exist.
The two spaces seem to have become one, and the path can't be found.
Does anyone know what might be causing this?

Error while try to rename a file name in matlab

This is my code:
filename_date = strcat('Maayanei_yeshua-IC_',file_date,'.pdf')
filenamepdf = strcat(filename,'.pdf')
rename(['C:\Users\user\Desktop\' filenamepdf],['C:\Users\user\Desktop\' filename_date]);
And i get the error:
<??? Error using ==> movefile The system cannot find the path specified.>
or
<??? Undefined function or method 'rename' for input arguments of type 'char'.>
I checked hundreds of times and the file is there... i don't know why it can't find it, any help ?
Use the command
doc rename
to discover that rename is for working with ftp servers, which you are not doing here. What you want is the command movefile
Use the help window brought up by helpwin to look up all the commands you are using.
Also, from the command prompt try
dir(['C:\Users\user\Desktop\' filenamepdf])
to verify the file you want to move exists.