This is unrelated to Java, however the error occurs when I try to compile my code.
The semicolon in the command is causing Windows cmd to fail
Example
c:\>cd c:\windows <- no error
c:\>cd c:\windows; <- the semicolon is not being used a command separator but as part of the path
The system cannot find the path specified.
cmd doesn't use semicolon as a command separator. If you want to have two commands on the same line, you need to use & or | (depending on what you're trying to do).
; is used as an argument separator on Windows, but it's not supported by most applications. It has nothing to do with cmd, and cmd isn't supposed to deal with it (applications parse their command lines, not cmd). It also doesn't apply to cmd intrinsics like cd (cd is not an application).
If you have a directory with a semicolon in the name try wrapping it in "double quotes."
Can't exactly verify your problem, but see below.
Z:\[]>dir
Volume in drive Z has no label.
Volume Serial Number is CAC7-078B
Directory of Z:\
11/27/2019 08:53 <DIR> .
11/27/2019 08:53 <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 871243935744 bytes free
Z:\[]>md zz
Z:\[]>md zz;
A subdirectory or file zz already exists.
Z:\[]>md "zz;"
Z:\[]>dir
Volume in drive Z has no label.
Volume Serial Number is CAC7-078B
Directory of Z:\
11/27/2019 08:54 <DIR> .
11/27/2019 08:54 <DIR> ..
11/27/2019 08:54 <DIR> zz
11/27/2019 08:54 <DIR> zz;
0 File(s) 0 bytes
4 Dir(s) 871243935744 bytes free
Z:\[]>cd zz;
Z:\zz;[]>cd ..\zz
Z:\zz[]>cd "..\zz;"
Z:\zz;[]>
The issue has been resolved with the following
Adding -J-Djdk.lang.Process.allowAmbiguousCommands=true to netbeans_default_options= in etc/netbeans.conf
The output from the compile command has not changed, however it now finds the directories???
Related
when I try "dir" I get:
02/13/2020 03:29 PM <DIR> Saved Games
02/13/2020 03:29 PM <DIR> Searches
02/16/2020 12:57 PM <DIR> Videos
1 File(s) 0 bytes
16 Dir(s) 21,887,438,848 bytes free
<<<<<<<this new line is what I want to delete or disable
I tried commands like
findstr "." test.txt > output.txt
but they all add that new line at the end.
Thank you
EDIT:
I export "dir /B" to a file > output.txt
I need this because another program uses the list, and the last new line crashes it.
The program that loops through that list is hardcoded, so I need to provide it a list without the blank line.
I am trying to create a mercurial repository in a directory whose name includes dollar signs. This is an equivalent and simplified example of what i get on windows 10 cmd.exe with mercurial 4.1.3 :
C:\test\dir1>hg init
C:\test\dir1>hg status
C:\test\dir1>cd ../dir$$1
C:\test\dir$$1>hg init
C:\test\dir$$1>hg status
abort: repository C:\test\dir$$1 not found!
so i hope this is clear, the only difference seems to be the dollar signs in the second directory name. thanks in advance!
Mercurial seems to treat dollar signs as an environment variable escape:
C:\test>set X=abc
C:\test>echo $X # Not the shell expanding it, that would be %X%.
$X
C:\test>hg init $X
C:\test>dir
Volume in drive C has no label.
Volume Serial Number is CE8B-D448
Directory of C:\test
11/10/2017 09:27 PM <DIR> .
11/10/2017 09:27 PM <DIR> ..
11/10/2017 09:27 PM <DIR> abc
0 File(s) 0 bytes
3 Dir(s) 53,899,231,232 bytes free
Mercurial has expanded $X as an environment variable. Also:
C:\test>hg init dir$$x
C:\test>dir
Volume in drive C has no label.
Volume Serial Number is CE8B-D448
Directory of C:\test
11/10/2017 09:30 PM <DIR> .
11/10/2017 09:30 PM <DIR> ..
11/10/2017 09:30 PM <DIR> dir$x
0 File(s) 0 bytes
3 Dir(s) 53,899,091,968 bytes free
Two dollar signs insert one dollar sign. When you are in a directory named dir$$x, Mercurial is using dir$x for the name. I found a workaround with hg -R. status, but better to avoid dollar signs.
this has been entered as a Mercurial bug : https://bz.mercurial-scm.org/show_bug.cgi?id=5739
I use Mathematica 11 and create a project containing two files: a package file named MyPackage.m and the other named run.m.The package file contains just normal functions not in special Mathematica package structure (https://reference.wolfram.com/workbench/index.jsp?topic=/com.wolfram.eclipse.help/html/tasks/applications/packages.html) and the other contains code to get MyPackage.m and use the functions.
(* Package.m *)
myFun[x_String] := Print[x]
...
(* run.m *)
<<"Package.m"
myFun["Hello,World"]
I put these two files into one directory and ensure that the $path contains the directory path. But, when I run wolframscript -file ./run.m -print all, it complains $Failed.
The question is: how to import another file when using wolframscript? It seems cannot find the destination file even they are in the same directory.
I use Mathematica 11 and run wolframscript in Ubuntu server where I have installed the latest Free CDF Player.
I encountered no problem running your script. Also, -print all appears to be superfluous.
C:\Users\chrisd\Documents\test>dir
Volume in drive C is Windows7_OS
Volume Serial Number is 102A-B66B
Directory of C:\Users\chrisd\Documents\test
14/09/2017 15:03 <DIR> .
14/09/2017 15:03 <DIR> ..
14/09/2017 14:59 29 Package.m
14/09/2017 14:59 38 run.m
2 File(s) 67 bytes
2 Dir(s) 215,590,776,832 bytes free
C:\Users\chrisd\Documents\test>wolframscript -file run.m -print all
Hello,World
C:\Users\chrisd\Documents\test>type Package.m
myFun[x_String] := Print[x]
C:\Users\chrisd\Documents\test>type run.m
<<"Package.m"
myFun["Hello,World"];
C:\Users\chrisd\Documents\test>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am trying to make a backup of the files in a corrupted MySQL database before doing a clean install from a different backup file. I am on a windows 7 machine. Someone suggested the following, but the mv command does not work on windows:
mv /var/lib/mysql /var/lib/mysql.old
So instead, I am trying to use robocopy, but I am getting a range of different error messages with each attempt. Here is a screen shot of some of the error messages for my various attempts:
Here is a link to the complete suggested code in a related posting, if it helps anyone suggest the correct syntax: Click Here
I tried xcopy but am getting the following error result:
Then I tried move but got the following results, despite trying a few different ways of doing the slashes:
I added a C:\ProgramData\MySQL\bkup folder to my hard drive and tried the following:
why don't use this syntax ? :
xcopy /s SOURCEDIR DESTDIR
eg: xcopy /s C:\Users\Iman\Desktop\k C:\Users\Iman\Desktop\kk
Here's a possible approach, since the paths seem to be crossing you up:
MD C:\BackupDir
Subst G: c:\BackupDir
Cd C:\MypathtoMysql
G: (Switch to G drive)
Xcopy C:*.* /s /e
That way you're in the directory you want to copy so no need to specify it, and you're copying to a local location rather than a path location.
So, I've done this to prove what I tried to convey in the comments:
Created a directory called C:\ProgramData\directory 1\sub-directory a, and two files in it:
C:\>dir "C:\ProgramData\directory 1\sub-directory a"
Volume in drive C has no label.
Volume Serial Number is 303C-DB3D
Directory of C:\ProgramData\directory 1\sub-directory a
24/05/2014 22:35 <DIR> .
24/05/2014 22:35 <DIR> ..
24/05/2014 22:35 13 file 1
24/05/2014 22:35 13 file 2
2 File(s) 26 bytes
2 Dir(s) 1,076,169,957,376 bytes free
Created a directory C:\ProgramData\directory 2:
C:\>dir "C:\ProgramData\directory 2"
Volume in drive C has no label.
Volume Serial Number is 303C-DB3D
Directory of C:\ProgramData\directory 2
24/05/2014 22:35 <DIR> .
24/05/2014 22:35 <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 1,076,169,957,376 bytes free
Used move to move sub-directory a to C:\ProgramData\directory 2 like so:
C:\>move "C:\ProgramData\directory 1\sub-directory a" "C:\ProgramData\directory 2\sub-directory a"
1 dir(s) moved.
Confirmed that the directory and its files are where they should:
C:\>dir "C:\ProgramData\directory 2\sub-directory a"
Volume in drive C has no label.
Volume Serial Number is 303C-DB3D
Directory of C:\ProgramData\directory 2\sub-directory a
24/05/2014 22:35 <DIR> .
24/05/2014 22:35 <DIR> ..
24/05/2014 22:35 13 file 1
24/05/2014 22:35 13 file 2
2 File(s) 26 bytes
2 Dir(s) 1,076,169,957,376 bytes free
In conclusion:
move can be said to be a renaming operation: The first argument, the source, is the path of the file right now, the second argument, the destination, is what you want it to be.
The parent directory of the destination should exist. E.g. if I move to C:\ProgramData\directory 2\sub-directory a there should already be a directory C:\ProgramData\directory 2.
Arguments that contain a space need to be quoted, like the directory arguments to move. Each argument should be quoted on its own.
Use relative paths when you're sure about what they should be, otherwise use absolute paths.
Is there a reason why you want this done via command line? Why not use a file-diff tool such as Beyond Compare? This tool gives you a visual overview of file differences, but can be used to copy files to another folder for backup as well. Full binary comparison of files in different folders is possible too. See a screenshot. There is a command line version included.
Perhaps this topic from SuperUser can help: https://superuser.com/questions/748069/how-do-i-compare-two-folders-recursively-and-generate-a-list-of-files-and-folder - look down the list of answers and there will be an entry on RoboCopy and its use for a somewhat similar purpose.
Just when I'd thought I'd seen it all with Windows path issues, I've now encountered a case that only fails when '/' (forward-slash) is used as the path separator is used:
C:\temp\tcbugs>mkdir "dir1 with spaces"
C:\temp\tcbugs>echo hi > "dir1 with spaces"\foo.txt
C:\temp\tcbugs>type "dir1 with spaces\foo.txt"
hi
C:\temp\tcbugs>type "dir1 with spaces/foo.txt"
The system cannot find the file specified.
What is particularly interesting about this is that it appears to be specific to the cmd.exe shell and doesn't occur in PowerShell (nor presumably in the win32 API):
PS C:\temp\tcbugs> type 'dir1 with spaces/foo.txt'
hi
Another point of interest is that changing directories with 'cd' and using '/' used as a path separator with cmd.exe does work:
C:\temp\tcbugs>mkdir dir2_no_spaces
C:\temp\tcbugs>cd ./dir2_no_spaces
C:\temp\tcbugs\dir2_no_spaces>cd ..
Yet, I can't find any reference to this particular problem anywhere online nor in MSDN's commonly cited documentation:
Naming Files, Paths, Namespaces
Which leads me to ask: why does this happen, and is there a definitive source which documents this quirk?
UPDATE:
dbenham points out that the problem is present regardless of whether spaces are in a directory name, so removed reference to it in the title and question body. Also added an example of 'cd ./' that works, while other commands don't.
Edited to remove opinion
Whether or not Windows CMD.EXE is supposed to support forward slashes in paths, the fact is sometimes it works, sometimes it doesn't, and sometimes it appears to work but gives the wrong result - AKA a bug.
It's time for some experiments :-)
All tests were run on Vista
C:\>md "c:/temp/"
C:\>REM The forward slash works with MD!
C:\>echo hello world 1>>"c:/temp/test.txt"
C:\>REM Redirection works with forward slashes!
C:\>type "c:\temp\test.txt"
hello world
C:\>REM Of course TYPE works with back slashes
C:\>type "c:/temp/test.txt"
The system cannot find the file specified.
C:\>REM But forward slash version fails
C:\>type "c:/temp\test.txt"
hello world
C:\>REM But TYPE works with forward slash as long as last slash is back slash
C:\>dir "c:/temp/test.txt"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
File Not Found
C:\>REM Note how DIR lists the directory with a \, yet fails to find any files
C:\>dir "c:/temp/*"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
File Not Found
C:\>REM DIR Still fails with forward slashes
C:\>dir "c:/temp/"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
05/09/2012 09:58 PM <DIR> .
05/09/2012 09:58 PM <DIR> ..
05/09/2012 09:58 PM 13 test.txt
1 File(s) 13 bytes
2 Dir(s) 337,001,615,360 bytes free
C:\>REM But forward slash works if no file is specified!
C:\>dir "c:/temp\test.txt"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
05/09/2012 09:58 PM 13 test.txt
1 File(s) 13 bytes
0 Dir(s) 337,001,615,360 bytes free
C:\>REM And DIR works with forward slash as long as last slash is back slash
C:\>REM Now add another folder to the path hierarchy
C:\>md "c:/temp/temp/"
C:\>REM Still can create folder using forward slashes
C:\>copy "c:/temp/test.txt" "c:/temp/temp/"
The system cannot find the file specified.
0 file(s) copied.
C:\>REM Failed to copy with forward slashes
C:\>copy "c:/temp\test.txt" "c:/temp/temp/"
1 file(s) copied.
C:\>REM But forward slash works if last slash before file name is back slash
C:\>REM Rerun some past tests
C:\>type "c:/temp/test.txt"
The system cannot find the file specified.
C:\>REM Good - it still fails
C:\>dir "c:/temp/test.txt"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
05/09/2012 09:58 PM 13 test.txt
1 File(s) 13 bytes
0 Dir(s) 337,001,615,360 bytes free
C:\>REM What is going on?! :( Why did that seem to work now?
C:\>REM More on that later.
C:\>REM Now test the new folder
C:\>type "c:/temp/temp/test.txt"
The system cannot find the file specified.
C:\>REM Forward slashes still fail with TYPE
C:\>type "c:/temp/temp\test.txt"
hello world
C:\>REM But forward slash still works as long as last slash is back slash
C:\>dir "c:/temp/temp/*"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp\temp
File Not Found
C:\>REM Again, forward slashes fail, but directory path is listed properly
C:\>dir "c:/temp/temp/"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp\temp
05/09/2012 09:58 PM <DIR> .
05/09/2012 09:58 PM <DIR> ..
05/09/2012 09:58 PM 13 test.txt
1 File(s) 13 bytes
2 Dir(s) 337,001,615,360 bytes free
C:\>REM And again it works if no file is specified
C:\>dir "c:/temp/temp\test.txt"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp\temp
05/09/2012 09:58 PM 13 test.txt
1 File(s) 13 bytes
0 Dir(s) 337,001,615,360 bytes free
C:\>REM Again forward slashes work as long as last slash is back slash
Here is a case that clearly demonstrates a bug.
c:\>dir /s /a-d temp
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
05/10/2012 08:01 AM 13 test.txt
1 File(s) 13 bytes
Directory of c:\temp\temp
05/10/2012 07:57 AM 10 test.txt
1 File(s) 10 bytes
Total Files Listed:
2 File(s) 23 bytes
0 Dir(s) 337,325,191,168 bytes free
c:\>REM Note the different file sizes found in each directory
c:\>dir "c:/temp/test.txt"
Volume in drive C is OS
Volume Serial Number is EE2C-5A11
Directory of c:\temp
05/10/2012 07:57 AM 10 test.txt
1 File(s) 10 bytes
0 Dir(s) 337,325,191,168 bytes free
c:\>REM It is listing the wrong file!
One can debate whether Windows CMD is "supposed" to support forward slashes. But that last result is a bug! Even if there is operator error in using a forward slash, Windows should not give that result.
Wie had some strange behaviour with slash to and we traced it down to the fact, that a path with a leading slash isn't seen as an absolute path, so
C:\>cd /temp
C:\temp>rem works we are in the root directory
C:\temp>cd /temp
Das System kann den angegebenen Pfad nicht finden.
C:\temp>rem does't work but
C:\temp>cd \temp
C:\temp>rem \ indicates absolute path
C:\temp>cd ..
C:\>cd /temp
C:\temp> cd /ca
C:\temp\CA>rem qed
Perhaps it explains also the bug stated above - im not clear, at which directory the commands are executed.
I am not sure why the '/' is working in PS. Back to the history, DOS was based on UNIX and it is a small set of UNIX. In UNIX the path separator is '/', while in DOS it is '\'. I worked on some Windows and DOS apps before. In order to convert some UNIX pattern like commands or path and make sure they are valid DOS command or path, I wrote a small converter to transform '/' to '\' like this:
string fileNameFromWeb;
...
string windowsFile = fileNameFromWeb.repleace("/", #"\");
You may add this feature to tolerant '/' in your app in case of accessing to files in Windows. I guess PS may have this type converter to allow command or path using '/' or '\', or Windows will take '/' in file name.