如何摆脱角色"?"在For..Do批处理文件中?

时间:2016-03-27 23:13:13

标签: batch-file

我使用此代码将一些数据设置为数组但是,我仍然坚持回应最后一个拥有此字符的人mysql> SHOW ENGINES\G *************************** 1. row *************************** Engine: PERFORMANCE_SCHEMA Support: YES Comment: Performance Schema Transactions: NO XA: NO Savepoints: NO *************************** 2. row *************************** Engine: InnoDB Support: DEFAULT Comment: Supports transactions, row-level locking, and foreign keys Transactions: YES XA: YES Savepoints: YES *************************** 3. row *************************** Engine: MRG_MYISAM Support: YES Comment: Collection of identical MyISAM tables Transactions: NO XA: NO Savepoints: NO *************************** 4. row *************************** Engine: BLACKHOLE Support: YES Comment: /dev/null storage engine (anything you write to it disappears) Transactions: NO XA: NO Savepoints: NO *************************** 5. row *************************** Engine: MyISAM Support: YES Comment: MyISAM storage engine Transactions: NO XA: NO Savepoints: NO ... 所以;我的问题是如何逃避这种角色"?"以回应最后一项"?"

"Hackoo?"

2 个答案:

答案 0 :(得分:3)

如果您使用特殊字符SELECT AD.[AdsID] ,AD.[UID] ,AD.[Section] ,AD.[Category] ,AD.[Country] ,AD.[State] ,AD.[City] ,SUBSTRING([AdsTit],1,30)+'...' as AdsTit ,SUBSTRING([AdsDesc],1,85) as AdsDesc ,AD.[AdsPrice] ,AD.[Img1] ,AD.[Currency] ,AD.[Section] ,AD.[Currency] ,AD.[AdsDate] ,AD.[approvAds] ,UI.[approv] FROM [ads] as AD, UserInfo as UI where AD.[UID] = UI.[UID] and AD.[Country] = @Location AND AD.[approvAds]= 'Y' AND UI.[approv]='Y' ORDER BY [AdsDate] DESC FOR在没有任何切换的情况下使用CMD会尝试获取路径。

如果您不能使用任何其他开关(例如:?),则解决方案是替换:

/F

答案 1 :(得分:0)

@echo off
for /f "tokens=1-4" %%a in ("? * ; %%") do (
    echo %%a
    echo %%b
    echo %%c
    echo %%d
)
pause
相关问题