[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

控制台淘宝咸鱼第三方 咸鱼.EXE

淘宝咸鱼关闭了在电脑客户端上的搜索功能,因此咸鱼.EXE有必要存在。它能不安装咸鱼app,就能在电脑上使用咸鱼搜索功能。
用法:
  1. 咸鱼 [待搜索关键词]
复制代码
源码(请自行编译)
  1. #include <stdio.h>
  2. #include <windows.h>
  3. // 定义标准行长
  4. #define LINE_BUFF_SIZE 4096
  5. // 定义帮助说明
  6. #define HELP_INFORMATION "\
  7. 咸鱼 V1.0 - PC端咸鱼搜索工具\n\
  8. 使用:\n\
  9.     咸鱼 [关键词]\n"
  10. // 获取咸鱼PC端关键词搜索地址
  11. int GetSaltedfishURL(char* keyWords)
  12. {
  13. // 过滤保护
  14. if(strlen(keyWords) > LINE_BUFF_SIZE / 4)
  15. {
  16. fputs("Your key words is too long\n", stdout);
  17. }
  18. // 开辟内存
  19. char* keyEncode = (char*)malloc(LINE_BUFF_SIZE * sizeof(char));
  20. char* commandLine = (char*)malloc(LINE_BUFF_SIZE * sizeof(char));
  21. // 编码关键词
  22. char* ptr = keyEncode;
  23. while(*keyWords)
  24. {
  25. sprintf(ptr, "%%%02X", (unsigned char)(*keyWords));
  26. keyWords += 1, ptr += 3;
  27. }
  28. // 组合地址
  29. sprintf(commandLine, "%s%s", "start https://s.2.taobao.com/list/list.htm?q=", keyEncode);
  30. printf("%s\n", commandLine);
  31. // 打开网址链接
  32. system(commandLine);
  33. // 释放内存
  34. free(keyEncode);
  35. free(commandLine);
  36. return 0;
  37. }
  38. // MAIN主函数
  39. int main(int argc, char** argv)
  40. {
  41. // 参数不足,则抛出使用说明
  42. if(argc != 2)
  43. {
  44. fputs(HELP_INFORMATION, stdout);
  45. return 1;
  46. }
  47. // 执行核心函数
  48. GetSaltedfishURL(argv[1]);
  49. return 0;
  50. }
复制代码

本帖最后由 0000 于 2017-11-14 21:28 编辑

然而你忽略了bat的实力
咸鱼.bat 329B
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. 2>nul (
  4. set /p keyword=要找什么?
  5. set /p _=!keyword!<nul >#
  6. del $
  7. for %%# in (#) do fsutil file createnew $ %%~z#
  8. set URL=https://s.2.taobao.com/list/list.htm?q=
  9. for /f "tokens=2" %%# in ('fc /b # $') do if %%# NEQ # set URL=!URL!%%%%#
  10. del #
  11. del $
  12. start "" "!URL!"
  13. )
复制代码
1

评分人数

TOP

Get到一个新知识。
改成适合自己的
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. echo 1.百度 2.淘宝 3.BatHome
  4. choice /c 123
  5. if %errorlevel%==1 set URL=https://www.baidu.com/s?wd=
  6. if %errorlevel%==2 set URL=https://s.taobao.com/search?q=
  7. if %errorlevel%==3 set "URL=http://zhannei.baidu.com/cse/search?s=1324540215625407466&entry=1&ie=gbk&q="
  8. echo.
  9. 2>nul (
  10. :keyword
  11. set /p keyword=要找什么?
  12. if "!keyword!" EQU "" echo keyword不能为空&goto :keyword
  13. set /p _=!keyword!<nul >#
  14. if exist $ del $
  15. for %%# in (#) do fsutil file createnew $ %%~z# >nul
  16. for /f "tokens=2" %%# in ('fc /b # $') do if %%# NEQ # set URL=!URL!%%%%#
  17. del #
  18. del $
  19. start "" "!URL!"
  20. )
复制代码

TOP

返回列表