| | |
trying to run a string as a command
![]() |
•
•
Join Date: Jun 2008
Posts: 6
Reputation:
Solved Threads: 0
The program psexec runs any command remotely on another computer. the syntax is "psexec \\RemoteComputer cmd.exe"
I want to run "start "www.website.com" on computers a19-(01-29)
any help would be appreciated
I want to run "start "www.website.com" on computers a19-(01-29)
any help would be appreciated
C++ Syntax (Toggle Plain Text)
#include <cstdlib> #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { int compNum; compNum=0; std::string zero="0"; std::string foo,s1,s,s2,s3,s6,s7,s8,s10; std::string command; //////////////////////////////////////////////////////////////////////// for (compNum; compNum < 10;compNum++) { std::string compNum2; std::stringstream out; out << compNum; compNum2 = out.str(); //* s1="psexec "; s2= "\\"; s3="a19-"; s6=" cmd.exe"; s7=" '"; s8= "start"; command = " www.google.com"; s10="'"; foo = s1 + s2 += s2; foo += s3 += zero; foo += compNum2+= s6 += s7 += s8 += command; foo += s10; cout << foo; cout << "\n"; } /////////////////////////////////////////////////////////////////// for (compNum; compNum < 30;compNum++) { std::string compNum2; std::stringstream out; out << compNum; compNum2 = out.str(); s1="psexec "; s2= "\\"; s3="a19-"; s6=" cmd.exe"; s7=" '"; s8= "start"; command = " www.google.com"; s10="'"; foo = s1 + s2 += s2; foo += s3; foo += compNum2+= s6 += s7 += s8 += command; foo += s10; cout << foo; cout << "\n"; system(foo); } system("PAUSE"); return EXIT_SUCCESS; }
•
•
Join Date: Jan 2008
Posts: 3,757
Reputation:
Solved Threads: 491
I get these values in the foo variable when I run the program. Is this what should be passed to the system command?
•
•
•
•
psexec \\a19-00 cmd.exe 'start www.google.com'
psexec \\a19-01 cmd.exe 'start www.google.com'
psexec \\a19-02 cmd.exe 'start www.google.com'
psexec \\a19-03 cmd.exe 'start www.google.com'
psexec \\a19-04 cmd.exe 'start www.google.com'
psexec \\a19-05 cmd.exe 'start www.google.com'
psexec \\a19-06 cmd.exe 'start www.google.com'
psexec \\a19-07 cmd.exe 'start www.google.com'
psexec \\a19-08 cmd.exe 'start www.google.com'
psexec \\a19-09 cmd.exe 'start www.google.com'
psexec \\a19-10 cmd.exe 'start www.google.com'
psexec \\a19-11 cmd.exe 'start www.google.com'
psexec \\a19-12 cmd.exe 'start www.google.com'
psexec \\a19-13 cmd.exe 'start www.google.com'
psexec \\a19-14 cmd.exe 'start www.google.com'
psexec \\a19-15 cmd.exe 'start www.google.com'
psexec \\a19-16 cmd.exe 'start www.google.com'
psexec \\a19-17 cmd.exe 'start www.google.com'
psexec \\a19-18 cmd.exe 'start www.google.com'
psexec \\a19-19 cmd.exe 'start www.google.com'
psexec \\a19-20 cmd.exe 'start www.google.com'
psexec \\a19-21 cmd.exe 'start www.google.com'
psexec \\a19-22 cmd.exe 'start www.google.com'
psexec \\a19-23 cmd.exe 'start www.google.com'
psexec \\a19-24 cmd.exe 'start www.google.com'
psexec \\a19-25 cmd.exe 'start www.google.com'
psexec \\a19-26 cmd.exe 'start www.google.com'
![]() |
Other Threads in the C++ Forum
- Previous Thread: illegal token for "::"
- Next Thread: problem in makefile
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes code coding compaitibility compile console conversion count delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error factorial file floatingpoint forms fstream function functions game givemetehcodez graph guessing gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loop looping loops map math matrix maze memory multiple net news node oop output parameter payment pointer problem program programming project projectassignmenthelp protection python random rank read recursion reference rpg skills string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






