![]() |
|
Batch issue - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: Batch issue (/Thread-Batch-issue) Pages:
1
2
|
Batch issue - loading... - 02-03-2017 How would one pipe a variable command into a new batch script without the command result being piped? For example if you do Code: @echo off
echo %username% > C:\users\%username%\desktop\piped.batinstead of piping the varible command itself, it pipes the commands result. RE: Batch issue - Hoss - 02-03-2017 So you want "%username%" to get piped to the file instead of the users' username? I'm not sure I completely understand your question. If that is what you are trying to do: Code: @echo off
echo ^%username^% > C:\users\%username%\desktop\piped.batRE: Batch issue - loading... - 02-03-2017 (02-03-2017, 10:52 PM)Hoss Wrote: So you want "%username%" to get piped to the file instead of the users' username? I'm not sure I completely understand your question. That's exactly what i'm trying to do, however this just makes it so I get "echo is off" in the piped file instead of the command :| RE: Batch issue - Killpot - 02-04-2017 Code: @echo off
echo %%username%% > C:\Users\%username%\Desktop\pipe.txtworked fine for me RE: Batch issue - loading... - 02-04-2017 (02-04-2017, 12:03 AM)Killpot Wrote: I tried that and it's not working for some reason. It does put the command into the file however when the command is run, it just echos the command instead of the output of the command. RE: Batch issue - Killpot - 02-04-2017 (02-04-2017, 12:48 AM)loading... Wrote:(02-04-2017, 12:03 AM)Killpot Wrote: Im not understanding what you're trying to say, post a log of what it's outputting and try to explain a little more on what exactly you want it to do RE: Batch issue - Hoss - 02-04-2017 Your solution good sir (or madam) Code: @echo off
(echo %%username%%) > C:\Users\%username%\Desktop\piped.batRE: Batch issue - loading... - 02-04-2017 (02-04-2017, 12:59 AM)Killpot Wrote:(02-04-2017, 12:48 AM)loading... Wrote:(02-04-2017, 12:03 AM)Killpot Wrote: I got it figured out. I had to remove the command as a variable (set user= %username%) wasn't working. oh well lol, thanks for the help! RE: Batch issue - Skullmeat - 02-04-2017 You can solve the problem by not using batch. XD Use C# if you are on windows. RE: Batch issue - loading... - 02-04-2017 (02-04-2017, 02:25 AM)Skullmeat Wrote: You can solve the problem by not using batch. XD Use C# if you are on windows. Batch is love. batch is life And i'd rather use C or C++ than C# if I was doing anything actually constructive. At the moment i'm just fiddling around with dumb crap in batch due to boredom. |