如何使用空格"若"? [英] How to use spaces in "if"?

查看:150
本文介绍了如何使用空格"若"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看看是否一个字符串是相同的另一个字符串使用如果,但是字符串中包含空格!

I'm trying to see if a string is the same as another string by using if, but the string contains spaces!

这看起来是这样的:

if %DriveDir%==NOT BOOT FILES echo Working

简单地说,它说:BO​​OT是在这个时候意外

Simply put, it says "BOOT was unexpected at this time"

if %DriveDir%=="NOT BOOT FILES" echo Working
if %DriveDir%==%nbf% echo Working

我曾尝试使用引号和存储在这样一个变量的字符串,但没有任何变化。

I have tried using quotes and storing the string in a variable like this, but nothing changes.

推荐答案

您还应该加上引号变量。

You should also add quotes to variables.

if "%DriveDir%"=="NOT BOOT FILES" echo Working

这篇关于如何使用空格"若"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆