working-directory

Why does 'Run as administrator' change (sometimes) batch file's current directory?

眉间皱痕 提交于 2019-11-28 12:03:40
I have a batch file that is in the same directory as the file I want to xcopy . But for some reason the file is not being found. I thought that current directory was always where the batch file was located. I run batch file as administrator. This occurs on a Windows 7 64-bit desktop computer. Batch file: @ECHO OFF XCOPY /y "File1.txt" "File2.txt" PAUSE Error: File not found - File1.txt 0 File(s) copied Which directory is current working directory on starting a batch file with context menu item Run as administrator depends on User Account Control (UAC) setting for the current user. This can be

Working folder in ASP.NET

久未见 提交于 2019-11-28 08:14:44
问题 We have a web application written in ASP.NET 3.5. In it, we access a file in the code-behind. (Ordinary C# file access, done on the server during the page life-cycle, this has nothing to do with URLs or web browsers). On our production systems, we specify the full path to the file in question in the web.config. We'd like to be able to include a local copy of the file in the project in version control, and then to use a relative path in the version-controlled web.config to point to it, so that

Getting a working copy of a bare repository

余生颓废 提交于 2019-11-28 06:48:28
I have a server on which I have a bare repository for pushing. However, my server needs to have a working copy of the master branch. How do I get a working copy and that only from a bare repository? You can simply clone the repository to another directory on the same machine: git clone /bare/repo/dir.git The current directory will become a non-bare clone of your repo, and you'll get a checkout of the master branch automatically. Then use the usual commands like git pull to update it as needed. As a side benefit, this operation is very efficient — if you specify a local directory to git clone ,

Gulp change working directory for entire task

≯℡__Kan透↙ 提交于 2019-11-28 02:47:46
问题 I'm working on a gulp file that contains tasks for both the frontend and the backend of my site. The task below for example will concat my scripts into app.js: gulp.task 'frontend:scripts', -> gulp.src frontendPath(scriptsFolder, scriptsPattern) .pipe sourcemaps.init() .pipe coffee() .pipe concat 'app.js' .pipe sourcemaps.write('.') .pipe gulp.dest frontendPath(tempFolder, scriptsFolder) As you can see I've created a helper to provide the correct frontend path: frontendPath = (dirs...) ->

Python: subprocess with different working directory [duplicate]

梦想的初衷 提交于 2019-11-28 02:43:59
问题 This question already has an answer here : How can I specify working directory for popen (1 answer) Closed 4 years ago . I have a python script that is under this directory: work/project/test/a.py Inside a.py , I use subprocess.POPEN to launch the process from another directory, work/to_launch/file1.pl, file2.py, file3.py, ... Python Code: subprocess.POPEN("usr/bin/perl ../to_launch/file1.pl") and under work/project/, I type the following [user@machine project]python test/a.py, error "file2

Find Install directory and working directory of VSTO Outlook Addin; or any Office Addin

十年热恋 提交于 2019-11-27 23:12:35
I created a VSTO Outlook Addin that uses a library Html2Xhtml.dll (.NET) which calls another Html2xhtml.exe by executing System.Diagnostic.Process.Start(). However, it fails to call Html2xhtml.exe (i think) because the working directory even when launched from Visual Studio is the current user My Documents folder. I have no control over the code in Html2Xhtml.dll so I cannot use absolute path; but I suppose I can change the working directory of the Add-in at runtime. However, If I install this via ClickOnce or some other means where I do not know the install path the user is going to choose,

Does CMake offer a method to set the working directory for a given build system to use when running/debugging the project?

馋奶兔 提交于 2019-11-27 21:09:20
I have a project with the following structure: project_name/CMakeLists.txt project_name/src project_name/resources ... project_name-build/configuration_name/project_name.exe I want my application to be run in the root project directory project_name so it can directly access resources . Does CMake provide a method to specify this property, or will I have to manually set it in each build environment I use? I've looked around in the documentation and haven't found anything other than the possibility of setting up a post-build event to run my project from the desired directory which is less than

Golang: tests and working directory

时光总嘲笑我的痴心妄想 提交于 2019-11-27 18:59:16
I'm writing some unit tests for my application in Go. The tests fail however because it cannot find the configuration files. Normally the binary looks for the configuration files in the working directory under the path conf/*.conf . I figured that browsing to the directory that has conf/ and running go test in it would solve it, but it still reports that the file system cannot find the path specified. How can I tell go test to use a certain directory as the working directory so that the tests may actually be executed? N8Theo You may be able to use the Caller to get the path to the current test

Python file open() in Enthought Canopy fails with: “IOError No such file or directory”

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 18:26:23
问题 I'm running code under Enthought Canopy to open and read a file. It keeps telling me IOError. But I am pretty sure the text file name is right and it is in the same directory with the Python file, and the code works well in other IDEs like Python IDLE. Don't know what's wrong. Any suggestions? inFile = open('words.txt', 'r') words = inFile.read().split() fails with IOError: [Errno 2] No such file or directory: 'words.txt' 回答1: UPDATE: The following hack is not required in Canopy versions 1.0

Temporarily change current working directory in bash to run a command [duplicate]

大兔子大兔子 提交于 2019-11-27 17:03:50
This question already has an answer here: How do I run a program with a different working directory from current, from Linux shell? 11 answers I know I can use cd command to change my working directory in bash. But if I do this command: cd SOME_PATH && run_some_command Then the working directory will be changed permanently. Is there some way to change the working directory just temporarily like this? PWD=SOME_PATH run_some_command codaddict You can run the cd and the executable in a subshell by enclosing the command line in a pair of parentheses: (cd SOME_PATH && exec_some_command) Demo: $ pwd