SoftPerfect Network Scanner

Quotes added to the user-prompted parameters

Started by rmpf2

rmpf2

Quotes added to the user-prompted parameters   26 February 2019, 03:20

The following statement
%PsExec_VAR -h \\%0 cmd /c echo 10.0.64.185 some_name.com >> \\%0\c$\Windows\System32\drivers\etc\hosts
posts the results in hosts file
10.0.64.185 some_name.com

%PsExec_VAR -h \\%0 cmd /c echo {Enter ip host info:10.0.64.185 some_name.com} >> \\%0\c$\Windows\System32\drivers\etc\hosts
causes undesired output quotes:
"10.0.64.185 some_name.com"

Any idea how to avoid those quotes? (Dequote - Remove Quotes from a string)
SoftPerfect Support forum - Andrew avatar image

Re: Quotes added to the user-prompted parameters   26 February 2019, 17:04

The quotes are added because there is a space, meaning the string has to be enquoted into a single parameter.

In your case there may be an easy workaround:
  1. Open Notepad and hit Tab. Then copy that tab character.
  2. Insert the copied tab between the strings like this:
      ... cmd /c echo 10.0.64.185tabsome_name.com >> ...  
  3. The tab-separated string should be echoed unquoted and written to the file.

By the way, I don't quite understand why you are using psexec to execute the command remotely and then pass the same IP address in path. It looks like either of the following will also work:
cmd /c echo {Enter ip host info:10.0.64.185tabsome_name.com} >> \\%0\c$\Windows\System32\drivers\etc\hosts
or
%PsExec_VAR -h \\%0 cmd /c echo {Enter ip host info:10.0.64.185tabsome_name.com} >> C:\Windows\System32\drivers\etc\hosts

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 ********    *******   **    **  **    **  **     ** 
 **     **  **     **  ***   **  **   **    **   **  
 **     **         **  ****  **  **  **      ** **   
 ********    *******   ** ** **  *****        ***    
 **                **  **  ****  **  **      ** **   
 **         **     **  **   ***  **   **    **   **  
 **          *******   **    **  **    **  **     ** 

Message: