Windows Command Line errors that can't find file - windows

I don't know much about the command line but have been using it a lot lately. I was experiencing errors in a C application when trying to copy a file which didn't make sense; so, I tried using the the command line to make sure the code should work and get an error I don't understand.
copy "AH/Copy testing/media.enc" "AH/Copy testing/new_name.enc" returns the system cannot find the specified file. So, I tried type "AH/Copy testing/media.enc" and get the same error.
However, if change the directory to "AH/Copy testing", then type media.enc it works.
I tried the same statements on different files of the same and different extensions and they all work. For example, type "AH/Copy testing/fileName.enc" works.
Why would media.enc not be found unless the directory is set to its own first? If I copy media.enc to other locations, I get the same error unless the directory is first changed.
Thank you.

Related

Getting file contents from TEE's Tf.Cmd command line

I am trying to get the file contents from a specific revision in TEE. According to https://msdn.microsoft.com/en-us/library/gg413270(v=vs.100).aspx the command should be something to the affect of : tf print -version:C1999 Class1.java. This is the error I am receiving:
An argument error occurred: The specified file does not exist at the specified version.
I know I am logged in and my credentials are cached as I am able to query for information like the History command. I also know that the file does exist in this revision as I am getting the information from the history query. Also using Tf.Exe (provided by visual studios) I am able to successfully run :
tf view -version:C1999 Class1.java
and get the contents perfectly fine. Unfortunately for this purpose I am unable to use tf.exe, and it has to the the TEE command line using Tf.Cmd, and they do not support the "view" command.
Any help on getting the file contents would be greatly appreciated.
edit- note I am using the full file path, and, as I said, it works perfectly fine in Tf.exe. Also I have tried using "$/" as the project root and still do not have any success.
Make sure you have installed the latest version of Team Explorer Everywhere.
To use this command, the Read permission on the file that you are
trying to print must be set to Allow.
Even though you could get tf view command to work. Also double check if you have related permission on that specific file.

Terminal says there is no file

enter image description here
PLEASE HELP! I can't seem to run my file. I've compiled it so it should run shouldn't it?
It also happens to my other files and I can't seem to fix it.
Ok, so a quick point of notice:
It is usually appreciated if you post your code directly in your question and use the code markup for that. It makes it easier to answer your question and prevents the image from turning into a dead-link at one point in time.
Then, regarding your code: it seems your Topic3ex1.c still has some errors, it always helps to fix them first. Maybe the errors are preventing Topic3ex1 (which I believe you have selected as the output file with the -o option? I am not familiar with gcc's syntax.) from being formed. Check if the file exist first by executing ls -a from the command line.
If you get a message saying "No such file or directory" while it is indeed there, this is usually caused by a lack of user rights. Try executing chmod u+x Topic3ex1.c and then run your command again. This will give your current user the right to execute the file (read up on chmod if you do not know it already, you will need it often).
Final question: is Topic3ex1 supposed to be a file or a folder? For if it is a file, then executing it like ./Topic3ex1 will only work if it is a shellscript (in that case, best rename your file to Topic3ex1.sh, its best to always mention the extension of the file). If it is a folder the ./ command won't do anything and the cd Topic3ex1 (cq. change directory-)command you where experiencing with will activate it as your working directory. If it is a file however, then the change directory command will, of course, be useless.

File disappeared after trying to move it in terminal

Can anyone tell me where my file may have gone after this command?
The file I'm missing is stats.cpp
And what is the correct command to move it from directory prog3a to prog3c?
Thank you.
Since you did not post the actual command you used I cannot tell you what happened to the file. What I can say is that unless you used the rm command, the file is not gone. Probably got its name changed if you cannot find it or it got moved somewhere else other than the intended destination.
The correct command you should use is
mv prog3a/stats.cpp prog3c/stats.cpp
This command should be run in the directory where both prog3a and prog3c folders exist (cd to it before running the command. This is assuming they're both inside the same directory).
A more specific answer can be provided if you tell us which command you initially ran specifically and the full paths of each folder.

install4j: Executing bash file

I am trying to run a bash file from install4j6. install4j does indeed try to run the bash file but it just returns an error at the end of the installation. The error is very generic and has no code reference or anything that will help me determine a solution - just a message that says "Error while executing file."
The only thing I can provide is how I have it setup in install4j6 since I am pretty sure that's my issue.
The bash file is defined in the root of my installation directory distribution tree and is named set_permissions.sh. For the sake of eliminating permissions being a cause, the file permission mode is set to 777 (both in install4j and on the file system).
I believe the issue is related to what I have set as my "working directory". I currently have it set to just ".". Is there a way to debug this further? Maybe get an actual error as to why it's not executing?
Ok, first a few things to check:
make sure that you're running the batch file after the install files step (you mention it being at the root of your install)
best to have the wait for termination checked and a variable for the return code.
redirect stderr to the log file (just in case)
As for working directory, . should work, but you can change it to ${installer:sys.installationDir} to make sure that it references the installation directory chosen by the user. You can also set the executable in the form of ${installer:sys.installationDir}\set_permissions.sh
Also, try and run just your shell script to make sure that it works :)

How can I gain permission to rename a file for my Ruby program?

As per the answer to this question, I am trying to backup a file by renaming it, before I replace it with a new, modified file with the old name.
As per the comments and the documentation here, I am using the following line of code:
File.rename(File.basename(modRaw), File.basename(modRaw)+'.bak')
However, when I do so, I get the following error at runtime:
The program then aborts. (leatherReplacer.rb is the name of my program, and line 88 is the above line of code)
How do I allow my program to rename the files it needs to to run successfully?
Windows has some special rules regarding permissions. The important one at work here, is that the OS prevents moving or renaming a file while the file is open.
Depending on the nature of your code (in size and scope) and the importance of the file you're trying to back up, it may be unfeasible or otherwise not worthwhile to refactor the code in such a way as to make backups possible.
You probably don't want to be calling File.basename in there, that strips off the directory:
Returns the last component of the filename given in *file_name*, which must be formed using forward slashes ("/") regardless of the separator used on the local file system.
So, if modRaw is /where/is/pancakes.house, then you're saying:
File.rename('pancakes.house', 'pancakes.house.bak')
But pancakes.house probably isn't in the script's current directory. Try without the File.basename calls:
File.rename(modRaw, modRaw + '.bak')
If you are owner of that file, use File.chmod to set desired permissions.
I don't know much about ruby, but could you run it under command line/bash with admin privileges, such as "run as administrator" or "su root"?
According to Objectmix and ruby-forum, you should set it to 755 or +x, then perhaps chown to yourself.
try using full file path e.t
File.rename('c:\pancakes.house', 'c:\pancakes.house.bak')
in win7 i encounter same problem

Resources