-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
special characters in file path #58
Comments
It is not clear where this path is used. Have you tried to use |
I'm having troubles with transfering downloaded files to an application if the file has & character (maybe others too) in its path. Surrounding with "" doesn't help... Executable -> [DOWNLOADED_PATH] -> Link Context -> Surround arguments with quote characters -> Error Execute cmd file with [start "path_to.exe" "%*"] in it -> [DOWNLOADED_PATH] -> Link Context -> Error Execute cmd file with [start "path_to.exe" "%*"] in it -> [DOWNLOADED_PATH] -> Link Context -> Surround arguments with quote characters -> Error Execute cmd file with [start "path_to.exe" %*] in it -> [DOWNLOADED_PATH] -> Link Context -> Surround arguments with quote characters -> Error Is there some walkaround here? |
Сan you help me with transferring files with special characters in their names to other programs on windows? Application fails to transfer for example a torrent to torrent client if the torrent file has symbols like &, + and other in it's name. |
It's hard to use batch script / cmd files with parameters which contain %&= and possibly some other characters, because many characters have special meaning in batch-world, even if surrounded in dquotes. Powershell also failed for me for some reason, so I used a JScript and cscript.exe as my "receiving parameters" endpoint, it also starts much faster than powershell scripts. Here is what I use to transfer webpage title and url to different text file(s) or clipboard (if you edit that in). Don't lint the code, things are still at experiment stage. o) exab_to_file.js: //##############################################################################
function arrayToFile( lines, filePath, append ) {
var fso, f, ts, s;
var ForReading = 1, ForWriting = 2, ForAppending = 8;
var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
var append = typeof append != "undefined" ? append : false;
var mode = append ? ForAppending : ForWriting;
//var AbsPath = String(Request.ServerVariables("PATH_TRANSLATED"));
//var FileToOpen = AbsPath.replace("counter.asp", "test.txt");
fso = new ActiveXObject("Scripting.FileSystemObject");
ts = fso.OpenTextFile( filePath, mode, true, TristateTrue);
for(var i=0;i<lines.length;i++) {
ts.WriteLine( lines[i] );
}
ts.Close( );
}
//##############################################################################
function copyFileContentToClipboard( filePath ) {
var oShell = new ActiveXObject("WScript.Shell");
var cmdLine = 'cmd.exe /c clip < "'+filePath+'"'
oShell.Run( cmdLine, 0, false);
}
//##############################################################################
function getNewTmpFileFullPath( tmpFileName ) {
var tmpFolderPath = new ActiveXObject("Scripting.FileSystemObject").GetSpecialFolder(2);
return tmpFolderPath+"\\" + tmpFileName;
}
//##############################################################################
//https://stackoverflow.com/a/8260383
function parseVideoIDFromYTUrl(url){ // was "youtube_parser()"
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
var match = url.match(regExp);
return (match&&match[7].length==11)? match[7] : false;
}
//##############################################################################
function getYoutubeThumbnailUrlByVideoID( ytVideoID) {
return "https://i.ytimg.com/vi/"+ ytVideoID + "/hqdefault.jpg";
}
//##############################################################################
function getDatestamp() {
var currentTime = new Date()
var years = currentTime.getFullYear();
var months = currentTime.getMonth()+1;
var days = currentTime.getDate();
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var seconds = currentTime.getSeconds()
if (months < 10) months = "0" + months;
if (days < 10) days = "0" + days;
if (hours < 10) hours = "0" + hours;
if (minutes < 10) minutes = "0" + minutes;
if (seconds < 10) seconds = "0" + seconds;
return years + "" + months + "" + days + "-" + hours + "" + minutes + "" + seconds;
//return years + "_" + months + "_" + days + " " + hours + ":" + minutes + ":" + seconds + " ";
}
//##############################################################################
// main
//##############################################################################
WSH.Echo( getDatestamp() );
var IN_url = WScript.Arguments(0);
var IN_title = WScript.Arguments(1);
var IN_filepath = WScript.Arguments(2);
WSH.Echo("IN_url : " + IN_url);
WSH.Echo("IN_title : " + IN_title);
WSH.Echo("IN_filepath: " + IN_filepath);
var appendMeContent = [];
appendMeContent.push( "" );
appendMeContent.push( getDatestamp() + " " + IN_title );
appendMeContent.push( " " + " " + IN_url);
var result = arrayToFile( appendMeContent , IN_filepath, true);
//var result = copyFileContentToClipboard( IN_filepath ); |
The path to my file includes special characters: file:////g:\Erich\01 Finanzen\16 Fremdwährungskredit Tilgungsträger\Zinsenaufteilung Erich-Claudia.xlsx MS-Excel opens but the file coudn'b be open: g:\Erich\01 Finanzen\16 Fremdw%C3%A4hrungskredit Tilgungstr%C3%A4ger\Zinsenaufteilung Erich-Claudia.xlsx couldn't be found.
The text was updated successfully, but these errors were encountered: