"Error in setwd(dir): cannot change working directory" - setwd

Trying to run a function where I set the directory to wherever is specified in the arguments.
However every time I do, I get the error message:
"Error in setwd(dir): cannot change working directory"
This happens even if I've already changed the wd manually in the console and I have absolutely no clue why it's being so annoying.
Thanks in advance!

Related

Setting Path on do file

I am new to Stata, and I am trying to set the path to the file location. However, it kept giving me error
I tried to fix it by changing the backward/forward slash, but it still gives me this error. Does anyone know where I am wrong?

How do I remove an Error.error file being created and cannot be deleted?

How do I delete/remove the "Error.error" file when the system says it is not there but it is?
The Error.error file was created somehow and I do not know why or how. However, the issue is the system has created this 0 byte file called "Error.error" and it cannot be deleted, even if I try a "permanent" delete command. It also will not allow me to delete any of the folder directory hierarchy in which is resides. When I do try create it, rename it, or create a physical file with the same name and extension, or try to delete this file directly or indirectly I receive the following error message:
"Could not find this item: This is no longer located in C:\maps\test. Verify the items location and try again." Then it list "Error.error" and its information. However, it is there visually.
Any thoughts or suggestions on how to remove or correct?
Thanks!
I had a very similar issue not too long ago where I had a file that was created by another program and whenever I tried to access or delete it, windows would give an error message like "...This is no longer located in...".
If you're having the same problem I was, here's how I got rid of the file. Start a command prompt. In the command prompt, enter a command like del "\\?\<full path to file>". So if your file name is "Error.error" and it is located in the folder "C:\maps\test", the command you would enter is
del "\\?\C:\maps\test\Error.error"
You can delete a folder that windows won't let you access in a similar way by changing the command from "del" to "rd /S".
If you don't know how to start a command prompt, simply click the start button and type "command". The start menu should offer an option named something like "Command Prompt - Desktop app". That's what you need to start.
I found a good explanation of what the "\\?\" means here.

using output from first line of code for input to 2nd line of code

I am getting a "File not found" error with trying to run Outlook in batch. Most likely due to an error in the way I am formatting the code. The script takes the contents of clipboard provided by 'getclip' as %1, zips it to clips.zip, uses && to pass to ipmnote which attaches it to a pre-loaded Outlook email
My original layout (which works) uses more lines of code and includes a mid-step of creating a file to be compressed. In trying to simplify the routine, I am getting errors saying Outlook cannot be found.
Outlook.exe is already in my System Path and I normally call it in using only the exe name. But I get the same "can't be located" error even when adding full path the file as shown here.
getclip>7z.exe a Clips.zip %1 -y && "C:\Program Files (x86)\Microsoft
Office\root\Office16\OUTLOOK.exe" /c ipm.note /m "email&subject=CLips.zip"
/a Clips.zip
Thanks for the quick reply. But the problem was the attachment. The error shown is somewhat open to interpretation since it implies that the issue is that Outlook cannot be found. In fact, what it could not find was the "clips.zip" file needed to attach it. Once i added the path to find the attachment, it works perfectly.
Sometimes, it helps to write in and ask the question. By following testing the sequence for each step of the outlook command, i found the issue was only there when i added the attachment with the /a at the end. By giving the full path to find 'clips.zip', all errors are gone and the email is perfect.
The broken line in the code was created by posting the code using the "Code" button. I added characters as needed to force it to display properly
I am sure there is a better way and I started to mention this but i figured most people would know that the proper path to Outlook especially being in quotes and all would not have a carriage return in the middle"

open "sapisvr.exe" file in C#

I need to open this sapisvr.exe file on button click using C#, i tried using process.start("file name") but couldn't get success.
File path:
%windir%\Speech\Common\sapisvr.exe -SpeechUX
or
C:\Windows\Speech\Common\sapisvr.exe
However when i opened it in command prompt (using this path:%windir%\Speech\Common\sapisvr.exe -SpeechUX) the it successfully got opened.
Can someone tell me how to open said exe file in c# code?
Thanks,
Vinod Bhatt
Firstly, check whether you have the .exe available at the supplied location. If so, follow the given logic. I have the sapisvr.exe at the following location and it's starts as expected.
Process.Start(#"C:\Windows\Speech\Common\sapisvr.exe", #"-SpeechUX");

how to take cmd output error message as an input to a batch file?

i have a oracle sqldeveloper file.
when i run it by using a batch file, if it encounter an error, the cmd will surely display the error.
what i want is, is it possible to take the cmd error as an input to trigger out my custom made error message??
if in cmd displaying any error for example:
Parameter not found
my custom-made error message in batch file will triggered out this error message in the cmd:
You Got An Error!
any help and suggestions are appreciated..
Thanks in advance!
You can redirect the output (both stdout and stderr) to a text file (or to nul if you don't care about the output), and check the value of `%ERRORLEVEL% after your script has been executed. If it is not 0, then display your own error message.
To redirect both stdout and stderr:
command parameters 1>>c:\log.txt 2>&1
I recommend using SQL*Plus instead of SQL Developer. You can add WHENEVER SQLERROR EXIT FAILURE to the top of the script (or EXIT SQL.SQLCODE if you are interested in the specific error code). Then the calling batch file will receive the error code in %ERRORLEVEL% and you can take action appropriately. There is also WHENEVER OSERROR EXIT FAILURE if your SQL script interfaces with the OS with the potential of failure there.
I don't think SQL*Plus uses stderr, so I don't think you need to worry about redirecting 2>&1.

Resources