Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 批次中%1和%1之间的差异?_Batch File_Variables - Fatal编程技术网

Batch file 批次中%1和%1之间的差异?

Batch file 批次中%1和%1之间的差异?,batch-file,variables,Batch File,Variables,在批处理中,我有时看到开关使用了%~1,也看到了%1。有什么区别?他们似乎都为我工作 例如: if "%~1"=="" echo No variable specified. 及 似乎可以互换工作。解释在For/?和call/?展开%1删除任何周围的引号(“) 您可能会发现此链接很有趣谢谢!非常感谢。 if "%1"=="" echo No variable specified. %~1 - expands %1 removing any surrounding qu

在批处理中,我有时看到开关使用了
%~1
,也看到了
%1
。有什么区别?他们似乎都为我工作

例如:

if "%~1"=="" echo No variable specified.


似乎可以互换工作。

解释在
For/?
call/?
展开%1删除任何周围的引号(“)


您可能会发现此链接很有趣

谢谢!非常感谢。
if "%1"=="" echo No variable specified.
    %~1         - expands %1 removing any surrounding quotes (")
    %~f1        - expands %1 to a fully qualified path name
    %~d1        - expands %1 to a drive letter only
    %~p1        - expands %1 to a path only
    %~n1        - expands %1 to a file name only
    %~x1        - expands %1 to a file extension only
    %~s1        - expanded path contains short names only
    %~a1        - expands %1 to file attributes
    %~t1        - expands %1 to date/time of file
    %~z1        - expands %1 to size of file
    %~$PATH:1   - searches the directories listed in the PATH
                   environment variable and expands %1 to the fully
                   qualified name of the first one found.  If the
                   environment variable name is not defined or the
                   file is not found by the search, then this
                   modifier expands to the empty string