小编gia*_*ora的帖子

当传递的参数带有引号时使用 DOS 启动命令

我有一个关于 DOS 启动命令的问题。\n我已经阅读过此主题:\n使用 DOS \xe2\x80\x9cstart\xe2\x80\x9d 命令并将参数传递给启动的程序\n使用“start”命令并将参数传递给启动的程序

\n\n

但我的问题有点不同。

\n\n

我有这个问题:我需要传递需要引用的路径。

\n\n

例如,如果路径没有引号,则效果很好:

\n\n

启动“”app.exe -选项c:\\ myapp \\ myfile.txt

\n\n

但如果路径有双引号,则不起作用。

\n\n

我的批处理文件中有这一行:

\n\n

启动“” myapp.exe -选项 %mypath%

\n\n

当 %mypath% 包含双引号(名称中包含空格或其他字符的路径)时,启动命令会返回非常奇怪的结果。

\n\n

谢谢\n桑德罗

\n

windows command-line batch-file

5
推荐指数
1
解决办法
3615
查看次数

使用".".charCodeAt()和String.fromCharCode用JS获取一些字符(代码值> 55349)

我有unicode字符和JS的问题.我有一个书签,以帮助我键入奇怪的unicode字符.

"".charCodeAt(pos)用来获取unicode代码来重现相同的奇怪字符,String.FromChardCode反之亦然.但是,对于具有unicode代码> 55349的字符,我遇到了一个问题:http: //en.wikipedia.org/wiki/Blackboard_bold

例如,对于Blackboard bold X(120169):

如果我试图从代码中获取它:

alert(String.fromCharCode(120169));
Run Code Online (Sandbox Code Playgroud)

如果我尝试直接从JS获取代码,我会获得另一个角色,同样的事情:

s="";
alert(s.charCodeAt(0))
alert(s.charCodeAt(1))
Run Code Online (Sandbox Code Playgroud)

结果:55349 56655

有一种方法可以处理这些字符吗?


javascript

2
推荐指数
1
解决办法
1713
查看次数

计算文件夹大小:空文件夹是否具有默认大小?

我正在尝试用Python计算文件夹的大小,但我的结果很奇怪.

这是我的代码片段:

def bestsize(filepath):
    """ Return a tuple with 3 values. The first is the file (or folder size). The second and third
    have sense only for folder and are the number of files and subdirectories in folder
    """
    from os.path import getsize, isdir
    if not(isdir(filepath)): return (getsize(filepath), 1, 0)
    else:
        lf = []
        ld = []
        for root, dirs, files in os.walk(filepath):
            for name in files: lf.append(os.path.join(root, name))
            for dir in dirs: ld.append(os.path.join(root, dir))
        return (sum(getsize(i) for i in …
Run Code Online (Sandbox Code Playgroud)

python windows

0
推荐指数
1
解决办法
814
查看次数

标签 统计

windows ×2

batch-file ×1

command-line ×1

javascript ×1

python ×1