如何在程序中打开%的网站? [英] How to open a website with % in a program?
本文介绍了如何在程序中打开%的网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想创建一个程序来打开特定的网页。
例如打开以下网站:
http:// xxxx / cgi-bin / main- cgi?json =%7b%2cmd%2%3a%2c%2bEnabled%2%3a%7d
xxxx意味着你需要进入的东西
我尝试过的事情:
1.我已经尝试过蝙蝠。
I just want to create a program to open specific webpage.
For example open the website below:
http://xxxx/cgi-bin/main-cgi?json=%7b%2cmd%2%3a%2c%2bEnabled%2%3a%7d
xxxx means something you need to enter
What I have tried:
1.I have tried in bat.
@set /p ip=please enter ip:
@start explorer.exe "http://%ip%/cgi-bin/main-cgi?json=%%7b%22cmd%22%3a654%2c%22bEnabled%22%3a1%7d"
@exit
2.我在C ++中尝试过
2.I have tried in C++
#include<stdio.h>
#include<windows.h>
int main() {
ShellExecute(NULL, "open", "http://IP/cgi-bin/main-cgi?json=%7b%%22cmd%22%3a654%2c%22bEnabled%22%3a1%7d", NULL, NULL, SW_HIDE);
return 0;
}
但是如你所知,%不会显示为角色。
我该怎么办?请帮忙。
But as you know, % don't show as a character.
What can I do? Please help.
推荐答案
百分比是url / query字符串中的特殊字符:以下数据作为字符。
加倍你的'%'字符:
Percent is a "special character" in url / query strings: the following data is taken as a character.
Double up on your '%' characters:
explorer.exe "http://codeproject.com/cgi-bin/main-cgi?json=%%7b%%%%22cmd%%22%%3a654%%2c%%22bEnabled%%22%%3a1%%7d"
并且它们以百分比字符传递。
and they wioll pass through as percent characters.
这篇关于如何在程序中打开%的网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文