@if (@X) == (@Y) @end /* JScript comment
@echo off
for /f "tokens=*" %%a in ('cscript //E:JScript //nologo "%~f0" "%~nx0" %* ') do set "number=%%a"
echo you've entered %number%
exit /b %errorlevel%
@if (@X)==(@Y) @end JScript comment */
WScript.StdErr.Write("Enter a number:");
WScript.StdIn.Read(0);
var strMyName = WScript.StdIn.ReadLine();
var num=parseInt(strMyName);
while(isNaN(num)){
WScript.StdErr.Write("Enter a number:");
WScript.StdIn.Read(0);
var strMyName = WScript.StdIn.ReadLine();
var num=parseInt(strMyName);
}
WScript.StdOut.WriteLine(num);
我想将变量'a'传递给exec_command .. 我试图从用户那里获取文件路径,并将其存储在变量a中,我想知道如何将变量a传递给exec_command函数下的Cd命令
答案 0 :(得分:1)
由于代码注入可能会带来一些安全漏洞,因此您不能直接将用户输入的格式设置为shell命令。
您可以在此处使用环境变量:
stdin,stdout,stderr=client.exec_command('cd "$a" && pwd', environment={'a': a})
答案 1 :(得分:0)
您尝试从变量构造命令吗?
MenuItemCompat.setOnActionExpandListener(searchItem,
new MenuItemCompat.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem menuItem) {
hideFab();
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem menuItem) {
if (mAdapter != null)
mAdapter.expandAll();
showFab();
return true;
}
});