filepath

Not able to launch bat file form VBScript if path contains a space

╄→гoц情女王★ 提交于 2019-12-01 06:31:18
I have been trying to launch myFileToRun.bat file from a path for example. D:\My Folder\batchfiles\myFileToRun.bat Below is the VBScript through which I'm trying to run it. Dim WshShell, strCurrentDirectory Set WshShell = CreateObject("WScript.Shell") strCurrentDirectory = WshShell.CurrentDirectory WshShell.Run strCurrentDirectory & "\myFileToRun.bat" , 0 Set WshShell = Nothing I'm not able to run it, as VBS is thowing error sayin "System cannot find the file specified" I have tried various methods mentioned in other similar posts in stackoverflow and other forums. Most of them say to add

Function to shrink file path to be more human readable

有些话、适合烂在心里 提交于 2019-12-01 05:57:29
Is there any function in c# to shink a file path ? Input : "c:\users\Windows\Downloaded Program Files\Folder\Inside\example\file.txt" Output : "c:\users\...\example\file.txt" Jeff Atwood posted a solution to this on his blog and here it is : [DllImport("shlwapi.dll", CharSet = CharSet.Auto)] static extern bool PathCompactPathEx([Out] StringBuilder pszOut, string szPath, int cchMax, int dwFlags); static string PathShortener(string path, int length) { StringBuilder sb = new StringBuilder(); PathCompactPathEx(sb, path, length, 0); return sb.ToString(); } It uses the unmanaged function

Swift 3.0 Getting URL of UIImage selected from UIImagePickerController

孤者浪人 提交于 2019-12-01 05:42:46
Note:- This question is only for Swift 3.0 I am able to get the path prio to Swift 3.0 I want to get UIImage's path picked in didFinishPickingMediaWithInfo method let imageUrl = info[UIImagePickerControllerReferenceURL] as? NSURL let imageName = imageUrl.lastPathComponent let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! let photoURL = NSURL(fileURLWithPath: documentDirectory) let localPath = photoURL.appendingPathComponent(imageName!) But this path is not pointing to my image, Even there is no any image in Documents folder. Can

Not able to launch bat file form VBScript if path contains a space

馋奶兔 提交于 2019-12-01 04:19:49
问题 I have been trying to launch myFileToRun.bat file from a path for example. D:\My Folder\batchfiles\myFileToRun.bat Below is the VBScript through which I'm trying to run it. Dim WshShell, strCurrentDirectory Set WshShell = CreateObject("WScript.Shell") strCurrentDirectory = WshShell.CurrentDirectory WshShell.Run strCurrentDirectory & "\myFileToRun.bat" , 0 Set WshShell = Nothing I'm not able to run it, as VBS is thowing error sayin "System cannot find the file specified" I have tried various

Get the __file__ of the function one level up in the stack

时光怂恿深爱的人放手 提交于 2019-12-01 03:42:52
I've found that I'm using this pattern a lot : os.path.join(os.path.dirname(__file__), file_path) so I've decided to put in a function in a file that has many such small utilities: def filepath_in_cwd(file_path): return os.path.join(os.path.dirname(__file__), file_path) The thing is, __file__ returns the current file and therefore the current folder, and I've missed the whole point. I could do this ugly hack (or just keep writing the pattern as is): def filepath_in_cwd(py_file_name, file_path): return os.path.join(os.path.dirname(py_file_name), file_path) and then the call to it will look like

Swift 3.0 Getting URL of UIImage selected from UIImagePickerController

泄露秘密 提交于 2019-12-01 02:19:23
问题 Note:- This question is only for Swift 3.0 I am able to get the path prio to Swift 3.0 I want to get UIImage's path picked in didFinishPickingMediaWithInfo method let imageUrl = info[UIImagePickerControllerReferenceURL] as? NSURL let imageName = imageUrl.lastPathComponent let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first! let photoURL = NSURL(fileURLWithPath: documentDirectory) let localPath = photoURL.appendingPathComponent(imageName

Get the __file__ of the function one level up in the stack

泪湿孤枕 提交于 2019-12-01 01:07:54
问题 I've found that I'm using this pattern a lot : os.path.join(os.path.dirname(__file__), file_path) so I've decided to put in a function in a file that has many such small utilities: def filepath_in_cwd(file_path): return os.path.join(os.path.dirname(__file__), file_path) The thing is, __file__ returns the current file and therefore the current folder, and I've missed the whole point. I could do this ugly hack (or just keep writing the pattern as is): def filepath_in_cwd(py_file_name, file_path

How to remove %20 from the file path?

筅森魡賤 提交于 2019-11-30 22:58:31
file:///home/ashu/Music/Collections/randomPicks/ipod%20on%20sep%2009/Coldplay-Sparks.mp3 How can I convert a string like the above to get the normal file path which I can pass to open() function? Have a look at url2pathname : import urllib2 path = urllib2.url2pathname("file:///home/ashu/Music/Collections/randomPicks/ipod%20on%20sep%2009/Coldplay-Sparks.mp3") This is called unquote. Avaiable from urllib. import urllib urllib.unquote('%20') 来源: https://stackoverflow.com/questions/4577120/how-to-remove-20-from-the-file-path

Can Greasemonkey work with the file:// protocol?

旧城冷巷雨未停 提交于 2019-11-30 20:18:21
I have a simple Greasemonkey script: // ==UserScript== // @name hello // @namespace http://www.webmonkey.com // @description A test of accessing documents using file:// protocol // @include http* file* // @grant none // ==/UserScript== alert("hi"); It works fine as long as the URL is of the form http://... How do I also get the script to run on URLs of the form file://... ? In the User Settings section I have http://* and file://* as the included pages and in the Script Settings section I have http* file* in the "Included Pages" box. See "Greaseable schemes" in the Greasemonkey docs .

Inno Setup Compiler “Cannot find the path specified” error with long paths

跟風遠走 提交于 2019-11-30 19:15:13
I am using a .iss script to build an exe file inside Inno Setup Compiler . I need to package some node_modules into this application so I have a line under [Files] which looks like this: Source: "{#SourcePath}Encore.Warehouse.UI\bin\Warehouse_Release\warehouse\*"; \ DestDir: "{app}\warehouse"; Flags: ignoreversion recursesubdirs createallsubdirs When I compile, I receive this error: Here is the compiler output: So, it appears to be running fine up until it aborted. My initial thought was that the browser.js doesn't exist but after double checking, this is not the case. Also, I'm using a